os-rust/src/test/run-pass/move-self.rs

19 lines
201 B
Rust
Raw Normal View History

struct S {
x: ~str
}
pub impl S {
fn foo(self) {
2013-02-15 02:44:18 -08:00
self.bar();
}
fn bar(self) {
println(self.x);
}
}
pub fn main() {
let x = S { x: ~"Hello!" };
x.foo();
}