Created
July 17, 2014 03:13
-
-
Save mtomwing/85c47944e0ddc7ddc1e3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fn compare<T:Ord>(a: &T, b: &T) -> int { | |
if a < b { | |
-1 | |
} | |
else if a > b { | |
1 | |
} | |
else { | |
0 | |
} | |
} | |
fn main() { | |
println!("{}", compare(&1u, &2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment