Created
January 2, 2014 05:06
-
-
Save lkuper/8215298 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
trait Printable { | |
fn print(&self) { println!("{:?}", *self) } | |
} | |
impl Printable for int {} | |
impl Printable for ~str { | |
fn print(&self) { println(*self) } | |
} | |
impl Printable for bool {} | |
impl Printable for float {} | |
fn main() { | |
1.print(); | |
(~"foo").print(); | |
true.print(); | |
3.14159.print(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment