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

19 lines
205 B
Rust
Raw Normal View History

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