Skip to content

Instantly share code, notes, and snippets.

@bstrie
Created May 21, 2014 00:54
Show Gist options
  • Save bstrie/7543d83e817d988d76a8 to your computer and use it in GitHub Desktop.
Save bstrie/7543d83e817d988d76a8 to your computer and use it in GitHub Desktop.
struct Foo<T> {
x: i16,
y: T
}
fn bar<T>(foo: Foo<T>) -> i16 {
foo.x
}
fn main() {
let foo1 = Foo { x: 0i16, y: 0i32 };
let foo2 = Foo { x: 0i16, y: 0i8 };
bar(foo1);
bar(foo2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment