Created
March 2, 2018 01:02
-
-
Save anonymous/995d0ffab5d6c717006c8d70eb87f041 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
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
use std::io::{Error, ErrorKind}; | |
fn hmm(go: bool) -> Result<String, Error> { | |
match go { | |
true => Ok(String::from("good to go")), | |
_ => Err(Error::new(ErrorKind::Other, "bad")), | |
} | |
} | |
fn gonogo(go: bool) -> Result<String, Error> { | |
hmm(go) | |
} | |
fn main() { | |
println!("{:?}", gonogo(true)); | |
println!("{:?}", gonogo(false)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment