Skip to content

Instantly share code, notes, and snippets.

@antifuchs
Created September 15, 2013 03:01
Show Gist options
  • Save antifuchs/6567690 to your computer and use it in GitHub Desktop.
Save antifuchs/6567690 to your computer and use it in GitHub Desktop.
fn sessionNumber(line: &str) -> Option<int> {
match(line.as_slice().split_iter(':').next()) {
Some(first) => int::from_str(first),
_ => None
}
}
fn occupiedSessions(output: ~str) -> @HashSet<int> {
let set = @HashSet::new();
for line in output.line_iter(){
// v----- screams "match arms have incompatible types: expected `bool` but found `()` (expected bool but found ())"
match sessionNumber(line) {
Some(n) => set.insert(n),
None => ()
}
()
}
set
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment