Last active
July 21, 2016 17:41
-
-
Save QuietMisdreavus/58abe912e50828b494716e9ead446db3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//i have kv, an iterator over a str.split call, whose next value is the value i'm working on | |
//in this match arm, i want to take the value and make it an i64 | |
try!(i64::from_str_radix(try!(kv.next().ok_or(error::Error::InvalidResponse)), 10).or(Err(error::Error::InvalidResponse))) | |
//oh wait, never mind, i need an Option<i64> anyway, and i'll try! it anyway further down, so this is much nicer | |
kv.next().and_then(|s| i64::from_str_radix(s, 10).ok()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment