1.0.0[−][src]Trait core::cmp::Eq
Trait for equality comparisons which are equivalence relations.
This means, that in addition to a == b and a != b being strict inverses, the equality must
be (for all a, b and c):
- reflexive:
a == a; - symmetric:
a == bimpliesb == a; and - transitive:
a == bandb == cimpliesa == c.
This property cannot be checked by the compiler, and therefore Eq implies
PartialEq, and has no extra methods.
Derivable
This trait can be used with #[derive]. When derived, because Eq has
no extra methods, it is only informing the compiler that this is an
equivalence relation rather than a partial equivalence relation. Note that
the derive strategy requires all fields are Eq, which isn't
always desired.
How can I implement Eq?
If you cannot use the derive strategy, specify that your type implements
Eq, which has no methods:
enum BookFormat { Paperback, Hardback, Ebook } struct Book { isbn: i32, format: BookFormat, } impl PartialEq for Book { fn eq(&self, other: &Self) -> bool { self.isbn == other.isbn } } impl Eq for Book {}Run
Implementors
impl Eq for ![src]
impl Eq for ()[src]
impl Eq for core::cmp::Ordering[src]
impl Eq for Infallible[src]
impl Eq for FpCategory[src]
impl Eq for IntErrorKind[src]
impl Eq for SearchStep[src]
impl Eq for core::sync::atomic::Ordering[src]
impl Eq for AllocError[src]
impl Eq for Layout[src]
impl Eq for LayoutErr[src]
impl Eq for TypeId[src]
impl Eq for CpuidResult[src]
impl Eq for CharTryFromError[src]
impl Eq for DecodeUtf16Error[src]
impl Eq for ParseCharError[src]
impl Eq for Error[src]
impl Eq for PhantomPinned[src]
impl Eq for NonZeroI8[src]
impl Eq for NonZeroI16[src]
impl Eq for NonZeroI32[src]
impl Eq for NonZeroI64[src]
impl Eq for NonZeroI128[src]
impl Eq for NonZeroIsize[src]
impl Eq for NonZeroU8[src]
impl Eq for NonZeroU16[src]
impl Eq for NonZeroU32[src]
impl Eq for NonZeroU64[src]
impl Eq for NonZeroU128[src]
impl Eq for NonZeroUsize[src]
impl Eq for ParseFloatError[src]
impl Eq for ParseIntError[src]
impl Eq for TryFromIntError[src]
impl Eq for RangeFull[src]
impl Eq for NoneError[src]
impl Eq for ParseBoolError[src]
impl Eq for Utf8Error[src]
impl Eq for Duration[src]
impl Eq for bool[src]
impl Eq for char[src]
impl Eq for i8[src]
impl Eq for i16[src]
impl Eq for i32[src]
impl Eq for i64[src]
impl Eq for i128[src]
impl Eq for isize[src]
impl Eq for str[src]
impl Eq for u8[src]
impl Eq for u16[src]
impl Eq for u32[src]
impl Eq for u64[src]
impl Eq for u128[src]
impl Eq for usize[src]
impl<'a> Eq for Location<'a>[src]
impl<'a> Eq for Utf8LossyChunk<'a>[src]
impl<A> Eq for (A,) where
A: Eq + ?Sized, [src]
A: Eq + ?Sized,
impl<A: Eq, B> Eq for (A, B) where
B: Eq + ?Sized, [src]
B: Eq + ?Sized,
impl<A: Eq, B: Eq, C> Eq for (A, B, C) where
C: Eq + ?Sized, [src]
C: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D> Eq for (A, B, C, D) where
D: Eq + ?Sized, [src]
D: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E> Eq for (A, B, C, D, E) where
E: Eq + ?Sized, [src]
E: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F> Eq for (A, B, C, D, E, F) where
F: Eq + ?Sized, [src]
F: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G> Eq for (A, B, C, D, E, F, G) where
G: Eq + ?Sized, [src]
G: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H> Eq for (A, B, C, D, E, F, G, H) where
H: Eq + ?Sized, [src]
H: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H: Eq, I> Eq for (A, B, C, D, E, F, G, H, I) where
I: Eq + ?Sized, [src]
I: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H: Eq, I: Eq, J> Eq for (A, B, C, D, E, F, G, H, I, J) where
J: Eq + ?Sized, [src]
J: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H: Eq, I: Eq, J: Eq, K> Eq for (A, B, C, D, E, F, G, H, I, J, K) where
K: Eq + ?Sized, [src]
K: Eq + ?Sized,
impl<A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H: Eq, I: Eq, J: Eq, K: Eq, L> Eq for (A, B, C, D, E, F, G, H, I, J, K, L) where
L: Eq + ?Sized, [src]
L: Eq + ?Sized,
impl<A: ?Sized, '_> Eq for &'_ A where
A: Eq, [src]
A: Eq,
impl<A: ?Sized, '_> Eq for &'_ mut A where
A: Eq, [src]
A: Eq,