mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
19 lines
238 B
Rust
19 lines
238 B
Rust
//@ run-pass
|
|
struct S {
|
|
x: String
|
|
}
|
|
|
|
impl S {
|
|
pub fn foo(self) {
|
|
self.bar();
|
|
}
|
|
|
|
pub fn bar(self) {
|
|
println!("{}", self.x);
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let x = S { x: "Hello!".to_string() };
|
|
x.foo();
|
|
}
|