Created
January 31, 2014 17:56
-
-
Save wycats/8738699 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 { | |
bar: ~Bar | |
} | |
struct Bar { | |
age: int | |
} | |
impl IndexMut<int,Bar> for Foo { | |
fn index_mut<'a>(&'a mut self, element: &int) -> &'a mut Bar { | |
&mut *self.bar | |
} | |
} | |
fn main() { | |
let foo = &mut Foo{ bar: ~Bar{ age: 10 } }; | |
let bar: &mut Bar = &mut foo[10]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment