1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// run-pass struct Foo { x: isize } impl Foo { pub fn new() -> Foo { Foo { x: 3 } } } pub fn main() { let x = Foo::new(); println!("{}", x.x); }