Skip to main content

user_compare_variant

Function user_compare_variant 

Source
pub fn user_compare_variant(op: BinOp) -> Option<(&'static str, bool)>
Expand description

Map an ordering BinOp (< / <= / > / >=) onto the Ordering variant name and whether the comparison is an equality (true) or inequality (false) against it, for lowering a user-Comparable comparison through compare:

opvariantequality
<"Less"true
>"Greater"true
<="Greater"false
>="Less"false

a < bcompare == Less, a <= bcompare != Greater, etc. Returns None for any non-ordering operator (the caller only invokes it after is_user_compare, which already restricts to the four ordering ops).