Skip to content

Instantly share code, notes, and snippets.

@Wilfred
Created May 29, 2015 23:09
Show Gist options
  • Save Wilfred/084ed9276a84a4999375 to your computer and use it in GitHub Desktop.
Save Wilfred/084ed9276a84a4999375 to your computer and use it in GitHub Desktop.
Adding methods to Iterator
trait Greet {
fn say_hello(&self) -> ();
}
impl Greet for Iterator {
fn say_hello(&self) {
println!("hello from an iterator!");
}
}
@Wilfred
Copy link
Author

Wilfred commented May 29, 2015

src/iterators.rs:7:16: 7:24 error: the value of the associated type `Item` (from the trait `core::iter::Iterator`) must be specified [E0191]
src/iterators.rs:7 impl Greet for Iterator {
                                  ^~~~~~~~
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment