Commit 53157279 authored by Per's avatar Per

a function instead of closure (less ergonomic)

parent 68ddbc22
......@@ -26,8 +26,13 @@ enum Command {
Freq(u32),
}
fn f(s: &&str) -> bool {
!(s == &"")
}
fn parse(s: &str) -> Result<Command, &str> {
let mut iter = s.split(' ').filter(|c| !(c == &""));
//let mut iter = s.split(' ').filter(|c| !(c == &""));
let mut iter = s.split(' ').filter(f);
match iter.next() {
Some("Stop") => Ok(Command::Stop),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment