Skip to content

Instantly share code, notes, and snippets.

@kerinin
Created October 8, 2014 21:02
Show Gist options
  • Save kerinin/ec3fb3d1dc5c710699b2 to your computer and use it in GitHub Desktop.
Save kerinin/ec3fb3d1dc5c710699b2 to your computer and use it in GitHub Desktop.
Traits
pub trait Fooable {
pub fn foo();
}
pub impl Fooable for String {
pub fn foo() {
println!("Hello world");
}
}
use foo::Fooable;
fn main() {
"string".to_string().foo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment