Created
June 30, 2013 04:50
-
-
Save jmgrosen/5893895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
value: uint | |
} | |
impl Sub<Foo, Foo> for Foo { | |
fn sub(&self, rhs: &Foo) -> Foo { | |
Foo {value: self.value - rhs.value} | |
} | |
} | |
fn main() { | |
let mut foo1 = Foo {value: 5}; | |
let foo2 = Foo {value: 2}; | |
foo1 -= foo2; | |
println(fmt!("%?", foo1)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment