-
-
Save theherk/18cd676edbb1ab23644ce5948ef9a879 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