Skip to main content

map_partial_cmp

Function map_partial_cmp 

Source
pub fn map_partial_cmp<M: Map + ?Sized>(
    a: &M,
    b: &dyn PartialReflect,
) -> Option<Ordering>
Expand description

Lexicographically compares two Map values according to their iteration order (suitable for ordered maps like BTreeMap).

For each entry pair (a_k, a_v) and (b_k, b_v) in the iteration order, compare a_k to b_k using reflect_partial_cmp, returning the first non-equal ordering. If keys are equal, compare values a_v and b_v similarly. If all compared entries are equal, the shorter map is Less and longer is Greater.

Returns None if the comparison couldn’t be performed (kinds mismatch or an element comparison returns None).