rokdocs
v0.1

rok::core::cmp

rok::core::cmp - total equality, ordering and hashing (stdlib spec 2.5). PartialEq / PartialOrd carry the comparison operators and stay with the other operator traits in ops.rok. Eq is a pure marker with no methods, so it has no slot.

Enums

Ordering

pub enum Ordering

The result of a three-way comparison (2.5.4).

  • Less
  • Equal
  • Greater
  • pub const fn is_lt(self) -> bool
  • pub const fn is_eq(self) -> bool
  • pub const fn is_gt(self) -> bool
  • pub const fn reverse(self) -> Ordering
Trait implementations 3
  • impl PartialEq for Ordering
  • impl Eq for Ordering
  • impl Debug for Ordering

Traits

Eq

pub trait Eq: PartialEq

Ord

pub trait Ord: PartialOrd + Eq

A total order (2.5.5).

  • fn cmp(self, rhs: Self) -> Ordering
  • const fn min(self, rhs: Self) -> Self
  • const fn max(self, rhs: Self) -> Self
  • const fn clamp(self, low: Self, high: Self) -> Self

Hash

pub trait Hash: Eq

a == b ⇒ a.hash() == b.hash() (2.5.6) - what Dict / Set rely on.

  • fn hash(self) -> u64