Function cmp
pub fn cmp(a: &Nibbles, b: &Nibbles) -> Ordering
Available on crate feature
trie
only.Expand description
Compares two Nibbles in depth-first order.
In depth-first ordering:
- Descendants come before their ancestors (children before parents)
- Siblings are ordered lexicographically
ยงExample
0x11 comes before 0x1 (child before parent)
0x12 comes before 0x1 (child before parent)
0x11 comes before 0x12 (lexicographical among siblings)
0x1 comes before 0x21 (lexicographical among siblings)
Result: 0x11, 0x12, 0x1, 0x21