pub trait ExOrd: Eq + PartialOrd {
type ExternalTraitSpecificationFor: Ord;
// Required methods
spec fn obeys_cmp_spec() -> bool;
spec fn cmp_spec(&self, other: &Self) -> Ordering;
exec fn cmp(&self, other: &Self) -> r : Ordering;
exec fn max(self, other: Self) -> r : Self;
exec fn min(self, other: Self) -> r : Self;
exec fn clamp(self, min: Self, max: Self) -> r : Self;
}
Required Associated Types§
Required Methods§
Sourcespec fn obeys_cmp_spec() -> bool
spec fn obeys_cmp_spec() -> bool
Sourceexec fn cmp(&self, other: &Self) -> r : Ordering
exec fn cmp(&self, other: &Self) -> r : Ordering
ensures
Self::obeys_cmp_spec() ==> r == self.cmp_spec(other),
Sourceexec fn max(self, other: Self) -> r : Self
exec fn max(self, other: Self) -> r : Self
ensures
Self::obeys_cmp_spec()
==> match other.cmp_spec(&self) {
Ordering::Less => r == self,
Ordering::Equal => r == other,
Ordering::Greater => r == other,
},
Sourceexec fn min(self, other: Self) -> r : Self
exec fn min(self, other: Self) -> r : Self
ensures
Self::obeys_cmp_spec()
==> match other.cmp_spec(&self) {
Ordering::Less => r == other,
Ordering::Equal => r == self,
Ordering::Greater => r == self,
},
Sourceexec fn clamp(self, min: Self, max: Self) -> r : Self
exec fn clamp(self, min: Self, max: Self) -> r : Self
requires
Self::obeys_partial_cmp_spec(),
min.partial_cmp_spec(&max) matches Some(Ordering::Less | Ordering::Equal),
ensuresSelf::obeys_cmp_spec()
==> match (self.cmp_spec(&min), self.cmp_spec(&max)) {
(Ordering::Less, _) => r == min,
(_, Ordering::Greater) => r == max,
_ => r == self,
},
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.