wiwi::prelude_std::cmp

Trait Eq

1.0.0 · Source
pub trait Eq: PartialEq { }
Expand description

Trait for comparisons corresponding to equivalence relations.

The primary difference to PartialEq is the additional requirement for reflexivity. A type that implements PartialEq guarantees that for all a, b and c:

  • symmetric: a == b implies b == a and a != b implies !(a == b)
  • transitive: a == b and b == c implies a == c

Eq, which builds on top of PartialEq also implies:

  • reflexive: a == a

This property cannot be checked by the compiler, and therefore Eq is a trait without methods.

Violating this property is a logic error. The behavior resulting from a logic error is not specified, but users of the trait must ensure that such logic errors do not result in undefined behavior. This means that unsafe code must not rely on the correctness of these methods.

Floating point types such as f32 and f64 implement only PartialEq but not Eq because NaN != NaN.

§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 extra 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 {}

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.

Implementors§

1.0.0 · Source§

impl Eq for wiwi::prelude_std::atomic::Ordering

1.34.0 · Source§

impl Eq for Infallible

1.0.0 · Source§

impl Eq for VarError

1.28.0 · Source§

impl Eq for wiwi::prelude_std::fmt::Alignment

Source§

impl Eq for BacktraceStyle

Source§

impl Eq for SearchStep

1.0.0 · Source§

impl Eq for wiwi::prelude_std::cmp::Ordering

Source§

impl Eq for alloc::collections::TryReserveErrorKind

Source§

impl Eq for AsciiChar

1.7.0 · Source§

impl Eq for IpAddr

Source§

impl Eq for Ipv6MulticastScope

1.0.0 · Source§

impl Eq for SocketAddr

1.0.0 · Source§

impl Eq for FpCategory

1.55.0 · Source§

impl Eq for IntErrorKind

1.65.0 · Source§

impl Eq for BacktraceStatus

1.0.0 · Source§

impl Eq for SeekFrom

1.0.0 · Source§

impl Eq for ErrorKind

1.0.0 · Source§

impl Eq for Shutdown

1.12.0 · Source§

impl Eq for RecvTimeoutError

1.0.0 · Source§

impl Eq for std::sync::mpsc::TryRecvError

Source§

impl Eq for Colons

Source§

impl Eq for Fixed

Source§

impl Eq for Numeric

Source§

impl Eq for OffsetPrecision

Source§

impl Eq for Pad

Source§

impl Eq for ParseErrorKind

Source§

impl Eq for SecondsFormat

Source§

impl Eq for Month

Source§

impl Eq for RoundingError

Source§

impl Eq for Weekday

1.0.0 · Source§

impl Eq for bool

1.0.0 · Source§

impl Eq for char

1.0.0 · Source§

impl Eq for i8

1.0.0 · Source§

impl Eq for i16

1.0.0 · Source§

impl Eq for i32

1.0.0 · Source§

impl Eq for i64

1.0.0 · Source§

impl Eq for i128

1.0.0 · Source§

impl Eq for isize

Source§

impl Eq for !

1.0.0 · Source§

impl Eq for str

1.0.0 · Source§

impl Eq for u8

1.0.0 · Source§

impl Eq for u16

1.0.0 · Source§

impl Eq for u32

1.0.0 · Source§

impl Eq for u64

1.0.0 · Source§

impl Eq for u128

1.0.0 · Source§

impl Eq for ()

1.0.0 · Source§

impl Eq for usize

Source§

impl Eq for wiwi::prelude_std::alloc_mod::AllocError

1.28.0 · Source§

impl Eq for Layout

1.50.0 · Source§

impl Eq for LayoutError

1.0.0 · Source§

impl Eq for Error

Source§

impl Eq for Assume

1.0.0 · Source§

impl Eq for RangeFull

Source§

impl Eq for wiwi::prelude_std::ptr::Alignment

1.0.0 · Source§

impl Eq for ParseBoolError

1.0.0 · Source§

impl Eq for Utf8Error

1.0.0 · Source§

impl Eq for FromUtf8Error

1.33.0 · Source§

impl Eq for PhantomPinned

1.0.0 · Source§

impl Eq for String

1.0.0 · Source§

impl Eq for TypeId

Source§

impl Eq for UnorderedKeyError

1.57.0 · Source§

impl Eq for alloc::collections::TryReserveError

1.64.0 · Source§

impl Eq for CString

1.64.0 · Source§

impl Eq for FromVecWithNulError

1.64.0 · Source§

impl Eq for IntoStringError

1.64.0 · Source§

impl Eq for NulError

1.34.0 · Source§

impl Eq for CharTryFromError

1.20.0 · Source§

impl Eq for ParseCharError

1.9.0 · Source§

impl Eq for DecodeUtf16Error

1.59.0 · Source§

impl Eq for TryFromCharError

1.27.0 · Source§

impl Eq for CpuidResult

1.64.0 · Source§

impl Eq for CStr

1.69.0 · Source§

impl Eq for FromBytesUntilNulError

1.64.0 · Source§

impl Eq for FromBytesWithNulError

1.0.0 · Source§

impl Eq for Ipv4Addr

1.0.0 · Source§

impl Eq for Ipv6Addr

1.0.0 · Source§

impl Eq for AddrParseError

1.0.0 · Source§

impl Eq for SocketAddrV4

1.0.0 · Source§

impl Eq for SocketAddrV6

1.0.0 · Source§

impl Eq for ParseFloatError

1.0.0 · Source§

impl Eq for ParseIntError

1.34.0 · Source§

impl Eq for TryFromIntError

1.3.0 · Source§

impl Eq for Duration

1.66.0 · Source§

impl Eq for TryFromFloatSecsError

1.0.0 · Source§

impl Eq for OsStr

1.0.0 · Source§

impl Eq for OsString

1.1.0 · Source§

impl Eq for FileType

1.0.0 · Source§

impl Eq for Permissions

Source§

impl Eq for std::os::unix::net::ucred::UCred

1.0.0 · Source§

impl Eq for Components<'_>

1.0.0 · Source§

impl Eq for Path

1.0.0 · Source§

impl Eq for PathBuf

1.7.0 · Source§

impl Eq for StripPrefixError

1.0.0 · Source§

impl Eq for ExitStatus

Source§

impl Eq for ExitStatusError

1.0.0 · Source§

impl Eq for Output

1.5.0 · Source§

impl Eq for std::sync::condvar::WaitTimeoutResult

1.0.0 · Source§

impl Eq for std::sync::mpsc::RecvError

1.26.0 · Source§

impl Eq for AccessError

1.19.0 · Source§

impl Eq for ThreadId

1.8.0 · Source§

impl Eq for std::time::Instant

1.8.0 · Source§

impl Eq for SystemTime

Source§

impl Eq for Parsed

Source§

impl Eq for InternalFixed

Source§

impl Eq for InternalNumeric

Source§

impl Eq for OffsetFormat

Source§

impl Eq for ParseError

Source§

impl Eq for Months

Source§

impl Eq for ParseMonthError

Source§

impl Eq for NaiveDate

Source§

impl Eq for NaiveDateDaysIterator

Source§

impl Eq for NaiveDateWeeksIterator

Source§

impl Eq for NaiveDateTime

Source§

impl Eq for IsoWeek

Source§

impl Eq for Days

Source§

impl Eq for NaiveTime

Source§

impl Eq for FixedOffset

Source§

impl Eq for Utc

Source§

impl Eq for OutOfRange

Source§

impl Eq for OutOfRangeError

Source§

impl Eq for TimeDelta

Source§

impl Eq for ParseWeekdayError

§

impl Eq for AllocError

§

impl Eq for Bytes

§

impl Eq for BytesMut

§

impl Eq for Domain

§

impl Eq for Elapsed

§

impl Eq for FilterOp

§

impl Eq for Id

§

impl Eq for Instant

§

impl Eq for Interest

§

impl Eq for Interest

§

impl Eq for MissedTickBehavior

§

impl Eq for OnceState

§

impl Eq for ParkResult

§

impl Eq for ParkToken

§

impl Eq for Protocol

§

impl Eq for Ready

§

impl Eq for RecvError

§

impl Eq for RecvError

§

impl Eq for RecvFlags

§

impl Eq for RequeueOp

§

impl Eq for RuntimeFlavor

§

impl Eq for SigId

§

impl Eq for SignalKind

§

impl Eq for SockAddr

§

impl Eq for Token

§

impl Eq for TryAcquireError

§

impl Eq for TryRecvError

§

impl Eq for TryRecvError

§

impl Eq for TryRecvError

§

impl Eq for TryReserveError

§

impl Eq for TryReserveError

§

impl Eq for TryReserveErrorKind

§

impl Eq for Type

§

impl Eq for UCred

§

impl Eq for UnparkResult

§

impl Eq for UnparkToken

§

impl Eq for WaitTimeoutResult

Source§

impl<'a> Eq for Utf8Pattern<'a>

1.0.0 · Source§

impl<'a> Eq for Component<'a>

1.0.0 · Source§

impl<'a> Eq for Prefix<'a>

Source§

impl<'a> Eq for Item<'a>

1.10.0 · Source§

impl<'a> Eq for Location<'a>

1.79.0 · Source§

impl<'a> Eq for Utf8Chunk<'a>

1.0.0 · Source§

impl<'a> Eq for PrefixComponent<'a>

1.0.0 · Source§

impl<A> Eq for &A
where A: Eq + ?Sized,

1.0.0 · Source§

impl<A> Eq for &mut A
where A: Eq + ?Sized,

§

impl<A> Eq for SmallVec<A>
where A: Array, <A as Array>::Item: Eq,

1.0.0 · Source§

impl<B> Eq for Cow<'_, B>
where B: Eq + ToOwned + ?Sized,

1.55.0 · Source§

impl<B, C> Eq for ControlFlow<B, C>
where B: Eq, C: Eq,

Source§

impl<Dyn> Eq for DynMetadata<Dyn>
where Dyn: ?Sized,

1.4.0 · Source§

impl<F> Eq for F
where F: FnPtr,

1.29.0 · Source§

impl<H> Eq for BuildHasherDefault<H>

1.0.0 · Source§

impl<Idx> Eq for wiwi::prelude_std::ops::Range<Idx>
where Idx: Eq,

1.0.0 · Source§

impl<Idx> Eq for wiwi::prelude_std::ops::RangeFrom<Idx>
where Idx: Eq,

1.26.0 · Source§

impl<Idx> Eq for wiwi::prelude_std::ops::RangeInclusive<Idx>
where Idx: Eq,

1.0.0 · Source§

impl<Idx> Eq for RangeTo<Idx>
where Idx: Eq,

1.26.0 · Source§

impl<Idx> Eq for RangeToInclusive<Idx>
where Idx: Eq,

Source§

impl<Idx> Eq for core::range::Range<Idx>
where Idx: Eq,

Source§

impl<Idx> Eq for core::range::RangeFrom<Idx>
where Idx: Eq,

Source§

impl<Idx> Eq for core::range::RangeInclusive<Idx>
where Idx: Eq,

1.0.0 · Source§

impl<K, V, A> Eq for BTreeMap<K, V, A>
where K: Eq, V: Eq, A: Allocator + Clone,

1.0.0 · Source§

impl<K, V, S> Eq for std::collections::hash::map::HashMap<K, V, S>
where K: Eq + Hash, V: Eq, S: BuildHasher,

§

impl<K, V, S, A> Eq for HashMap<K, V, S, A>
where K: Eq + Hash, V: Eq, S: BuildHasher, A: Allocator,

1.41.0 · Source§

impl<Ptr> Eq for Pin<Ptr>
where Ptr: Deref, <Ptr as Deref>::Target: Eq,

1.0.0 · Source§

impl<T> Eq for Option<T>
where T: Eq,

1.17.0 · Source§

impl<T> Eq for Bound<T>
where T: Eq,

1.36.0 · Source§

impl<T> Eq for Poll<T>
where T: Eq,

Source§

impl<T> Eq for std::sync::mpmc::error::SendTimeoutError<T>
where T: Eq,

1.0.0 · Source§

impl<T> Eq for std::sync::mpsc::TrySendError<T>
where T: Eq,

Source§

impl<T> Eq for LocalResult<T>
where T: Eq,

1.0.0 · Source§

impl<T> Eq for *const T
where T: ?Sized,

1.0.0 · Source§

impl<T> Eq for *mut T
where T: ?Sized,

1.0.0 · Source§

impl<T> Eq for [T]
where T: Eq,

1.0.0 · Source§

impl<T> Eq for (T₁, T₂, …, Tₙ)
where T: Eq + ?Sized,

This trait is implemented for tuples up to twelve items long.

1.2.0 · Source§

impl<T> Eq for Cell<T>
where T: Eq + Copy,

1.70.0 · Source§

impl<T> Eq for wiwi::prelude_std::cell::OnceCell<T>
where T: Eq,

1.2.0 · Source§

impl<T> Eq for RefCell<T>
where T: Eq + ?Sized,

1.21.0 · Source§

impl<T> Eq for Discriminant<T>

1.25.0 · Source§

impl<T> Eq for NonNull<T>
where T: ?Sized,

1.20.0 · Source§

impl<T> Eq for ManuallyDrop<T>
where T: Eq + ?Sized,

1.0.0 · Source§

impl<T> Eq for PhantomData<T>
where T: ?Sized,

1.28.0 · Source§

impl<T> Eq for NonZero<T>
where T: ZeroablePrimitive + Eq,

1.74.0 · Source§

impl<T> Eq for Saturating<T>
where T: Eq,

1.0.0 · Source§

impl<T> Eq for Wrapping<T>
where T: Eq,

1.0.0 · Source§

impl<T> Eq for Cursor<T>
where T: Eq,

1.0.0 · Source§

impl<T> Eq for std::sync::mpsc::SendError<T>
where T: Eq,

1.70.0 · Source§

impl<T> Eq for OnceLock<T>
where T: Eq,

1.19.0 · Source§

impl<T> Eq for Reverse<T>
where T: Eq,

§

impl<T> Eq for OnceCell<T>
where T: Eq,

§

impl<T> Eq for SendError<T>
where T: Eq,

§

impl<T> Eq for SendError<T>
where T: Eq,

§

impl<T> Eq for SendTimeoutError<T>
where T: Eq,

§

impl<T> Eq for SetError<T>
where T: Eq,

§

impl<T> Eq for TrySendError<T>
where T: Eq,

1.0.0 · Source§

impl<T, A> Eq for Arc<T, A>
where T: Eq + ?Sized, A: Allocator,

1.0.0 · Source§

impl<T, A> Eq for wiwi::prelude_std::Box<T, A>
where T: Eq + ?Sized, A: Allocator,

1.0.0 · Source§

impl<T, A> Eq for Rc<T, A>
where T: Eq + ?Sized, A: Allocator,

1.0.0 · Source§

impl<T, A> Eq for wiwi::prelude_std::Vec<T, A>
where T: Eq, A: Allocator,

1.0.0 · Source§

impl<T, A> Eq for BTreeSet<T, A>
where T: Eq, A: Allocator + Clone,

1.0.0 · Source§

impl<T, A> Eq for LinkedList<T, A>
where T: Eq, A: Allocator,

1.0.0 · Source§

impl<T, A> Eq for VecDeque<T, A>
where T: Eq, A: Allocator,

§

impl<T, A> Eq for Box<T, A>
where T: Eq + ?Sized, A: Allocator,

§

impl<T, A> Eq for Vec<T, A>
where T: Eq, A: Allocator,

1.0.0 · Source§

impl<T, E> Eq for Result<T, E>
where T: Eq, E: Eq,

Source§

impl<T, M> Eq for Nominal<T, M>
where T: Eq,

1.0.0 · Source§

impl<T, S> Eq for std::collections::hash::set::HashSet<T, S>
where T: Eq + Hash, S: BuildHasher,

§

impl<T, S, A> Eq for HashSet<T, S, A>
where T: Eq + Hash, S: BuildHasher, A: Allocator,

1.0.0 · Source§

impl<T, const N: usize> Eq for [T; N]
where T: Eq,

Source§

impl<T, const N: usize> Eq for Simd<T, N>

Source§

impl<Tz> Eq for Date<Tz>
where Tz: TimeZone,

Source§

impl<Tz> Eq for DateTime<Tz>
where Tz: TimeZone,

Source§

impl<Y, R> Eq for CoroutineState<Y, R>
where Y: Eq, R: Eq,