Skip to content

Instantly share code, notes, and snippets.

@Goyapa
Forked from anonymous/playground.rs
Created December 22, 2017 01:34
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 Goyapa/a49c4e39c6ce098ab6dc5c7121e31922 to your computer and use it in GitHub Desktop.
Save Goyapa/a49c4e39c6ce098ab6dc5c7121e31922 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
use std::ops::Add;
fn add<T: Add<V>, U: Add<W>, V, W>(v: (T, U), w: (V, W)) -> (T::Output, U::Output) {
(v.0 + w.0, v.1 + w.1)
}
fn main() {
let result = add((3, 5), (3, 7));
println!("Result = {:?}", result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment