core::cmp
API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。
total equality, ordering and hashing.
PartialEq / PartialOrd carry the comparison operators and
stay with the other operator traits in ops.nabi. Eq is a pure
marker with no methods, so it has no slot.
Enums
OrderingSource
pub enum OrderingThe result of a three-way comparison.
trueforLess.trueforEqual.trueforGreater.LessandGreaterswapped;Equalstays.selfunless it isEqual, thenother: a tie-break,a.0.cmp(b.0).then(a.1.cmp(b.1)).selfunless it isEqual, thenf(): a tie-break computed only on a tie.
Trait implementations 1
impl Debug for Ordering
Traits
EqSource
pub trait Eq: PartialEqTotal equality: == is reflexive, symmetric and transitive (no NaN).
A marker over PartialEq with no methods.
OrdSource
pub trait Ord: PartialOrd + EqA total order.
Compares
selfwithrhs:Less,EqualorGreater.The smaller of
selfandrhs;selfwhen they are equal.The larger of
selfandrhs;rhswhen they are equal.lowwhenselfis below it,highwhen above it, elseself. Panics whenlow > high.
HashSource
pub trait Hash: EqFeeds a value to a Hasher: equal values make the same
writes, so a == b hashes alike - what Dict / Set rely on.
The hash of
self; equal values hash equal.