1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
trait Foo { fn bar() -> i32; } struct Test(i32, f32); impl Foo for Test { fn bar() -> i32 { 123 } } fn main() { let a: i32; a = Test::bar(); }