Created
June 28, 2013 00:57
-
-
Save Aatch/5881675 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
#[allow(default_methods)]; | |
trait Foo { | |
pub fn visit_crate(&mut self) { | |
self.visit_mod([1,2,3]) | |
} | |
pub fn visit_mod(&mut self, a: &[uint]) { | |
for a.iter().advance |i| { | |
self.visit_item(i); | |
} | |
} | |
pub fn visit_item(&mut self, _i: &uint) { | |
} | |
} | |
struct Printer; | |
impl Foo for Printer { | |
pub fn visit_item(&mut self, _i: &uint) { | |
println("Item!"); | |
} | |
} | |
fn main() { | |
let mut a = Printer; | |
a.visit_crate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment