mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
20 lines
230 B
Rust
20 lines
230 B
Rust
//@ run-pass
|
|
struct Foo {
|
|
x: isize,
|
|
}
|
|
|
|
trait Stuff {
|
|
fn printme(&self);
|
|
}
|
|
|
|
impl Stuff for Foo {
|
|
fn printme(&self) {
|
|
println!("{}", self.x);
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let x = Foo { x: 3 };
|
|
x.printme();
|
|
}
|