The purpose of a max key annotation is to compare to some given key to implement the data structure logic.
Since we don't have a native implementation of PartialOrd<K>, then it is always mandatory to add unrelated boilerplate code on the data structure implementations.
The implementation of a generic PartialOrd is trivial and should
If MaxKey::Maximum(k), return k.partial_cmp(arg)
If MaxKey::NegativeInfinity, return Ordering::Less
The purpose of a max key annotation is to compare to some given key to implement the data structure logic.
Since we don't have a native implementation of
PartialOrd<K>
, then it is always mandatory to add unrelated boilerplate code on the data structure implementations.The implementation of a generic
PartialOrd
is trivial and shouldMaxKey::Maximum(k)
, returnk.partial_cmp(arg)
MaxKey::NegativeInfinity
, returnOrdering::Less