Skip to content

Glossary: Data Structures and Algorithms in Rust

Ordering

Also written: cmp, Less, Equal, Greater, Ord, then

The result of x.cmp(&y): Less, Equal or Greater. The .then(...) method compares a second pair only when the first comparison is Equal, so you can sort by two fields.

Where the book teaches it

Related terms

Stable sortderive