Created
September 1, 2019 13:34
-
-
Save takeouchida/91d4055a76b1786dc02c08d8fb606156 to your computer and use it in GitHub Desktop.
A similar code to Haskell's `sequence`.
This file contains 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
fn main() { | |
let v: Result<Vec<i32>, _> = "1 2 3".split(" ").map(|w| w.parse()).collect(); | |
println!("{:?}", v); // => Ok([1, 2, 3]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment