Skip to content
Snippets Groups Projects
Commit 53157279 authored by Per's avatar Per
Browse files

a function instead of closure (less ergonomic)

parent 68ddbc22
No related branches found
No related tags found
No related merge requests found
......@@ -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),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment