| 1 | use ordermaprust-analyzer cargo ordermap 1.2.0 crate/::{ordermaprust-analyzer cargo ordermap 1.2.0 macros/ordermap!, ordersetrust-analyzer cargo ordermap 1.2.0 macros/orderset!}; |
| 2 | |
| 3 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 4 | fn test_sortrust-analyzer cargo ordermap 1.2.0 test_sort().() { |
| 5 | let m = ordermaprust-analyzer cargo ordermap 1.2.0 macros/ordermap!! { |
| 6 | 1 => 2, |
| 7 | 7 => 1, |
| 8 | 2 => 2, |
| 9 | 3 => 3, |
| 10 | }; |
| 11 | |
| 12 | itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().( |
| 13 | m.sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]sorted_by().(|_k1, v1, _k2, v2| v1.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(v2)), |
| 14 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(7, 1), (1, 2), (2, 2), (3, 3)], |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 19 | fn test_sort_setrust-analyzer cargo ordermap 1.2.0 test_sort_set().() { |
| 20 | let s = ordersetrust-analyzer cargo ordermap 1.2.0 macros/orderset!! { |
| 21 | 1, |
| 22 | 7, |
| 23 | 2, |
| 24 | 3, |
| 25 | }; |
| 26 | |
| 27 | itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(s.sorted_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sorted_by().(|v1, v2| v1.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(v2)), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 7]); |
| 28 | } |