Skip to content

Instantly share code, notes, and snippets.

Created November 24, 2016 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0a9c8508b557cdbf44dbb1c21d66eef2 to your computer and use it in GitHub Desktop.
Save anonymous/0a9c8508b557cdbf44dbb1c21d66eef2 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn plus_5<T: Into<Option<i32>>>(t: T) {
let x = t.into();
println!("{:?}", x.unwrap() + 5);
}
fn main() {
plus_5(Some(10));
// plus_5(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment