Created
August 19, 2017 01:23
-
-
Save Ophirr33/a977d6586717948ed59d44e2234f299e to your computer and use it in GitHub Desktop.
rfc 2033 example
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
let mut v = [-5i32, 4, 1, -3, 2]; | |
v.sort_unstable(); | |
assert!(v == [-5, -3, 1, 2, 4]); | |
v.sort_unstable_by(|a, b| b.cmp(a)); | |
assert!(v == [4, 2, 1, -3, -5]); | |
v.sort_unstable_by_key(|k| k.abs()); | |
assert!(v == [1, 2, -3, 4, -5]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment