Trait kvarn_utils::prelude::cmp::Eq

1.0.0 · source ·
pub trait Eq: PartialEq<Self> { }
Expand description

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 == b implies b == a; and
  • transitive: a == b and b == c implies a == 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 {}

Implementors§

source§

impl Eq for CacheControlError

source§

impl Eq for RequestParseStage

source§

impl Eq for SanitizeError

1.7.0 · source§

impl Eq for IpAddr

source§

impl Eq for SocketAddr

1.28.0 · source§

impl Eq for kvarn_utils::prelude::fmt::Alignment

source§

impl Eq for ErrorKind

source§

impl Eq for SeekFrom

source§

impl Eq for Ipv6MulticastScope

source§

impl Eq for Shutdown

source§

impl Eq for SearchStep

source§

impl Eq for kvarn_utils::prelude::cmp::Ordering

source§

impl Eq for TryReserveErrorKind

1.34.0 · source§

impl Eq for Infallible

source§

impl Eq for Which

source§

impl Eq for FpCategory

1.55.0 · source§

impl Eq for IntErrorKind

source§

impl Eq for core::sync::atomic::Ordering

1.65.0 · source§

impl Eq for BacktraceStatus

source§

impl Eq for VarError

source§

impl Eq for BacktraceStyle

1.12.0 · source§

impl Eq for RecvTimeoutError

source§

impl Eq for TryRecvError

source§

impl Eq for Level

source§

impl Eq for LevelFilter

source§

impl Eq for bool

source§

impl Eq for char

source§

impl Eq for i8

source§

impl Eq for i16

source§

impl Eq for i32

source§

impl Eq for i64

source§

impl Eq for i128

source§

impl Eq for isize

source§

impl Eq for !

source§

impl Eq for str

source§

impl Eq for u8

source§

impl Eq for u16

source§

impl Eq for u32

source§

impl Eq for u64

source§

impl Eq for u128

source§

impl Eq for ()

source§

impl Eq for usize

source§

impl Eq for CriticalRequestComponents

source§

impl Eq for Error

source§

impl Eq for AddrParseError

source§

impl Eq for Ipv4Addr

source§

impl Eq for Ipv6Addr

source§

impl Eq for SocketAddrV4

source§

impl Eq for SocketAddrV6

source§

impl Eq for ParseBoolError

source§

impl Eq for Utf8Error

§

impl Eq for Bytes

§

impl Eq for BytesMut

§

impl Eq for CompactString

1.3.0 · source§

impl Eq for Duration

source§

impl Eq for HeaderName

source§

impl Eq for HeaderValue

1.8.0 · source§

impl Eq for Instant

source§

impl Eq for Method

source§

impl Eq for Path

source§

impl Eq for PathBuf

source§

impl Eq for StatusCode

source§

impl Eq for Uri

source§

impl Eq for Version

source§

impl Eq for Authority

source§

impl Eq for PathAndQuery

source§

impl Eq for Scheme

1.57.0 · source§

impl Eq for 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

source§

impl Eq for FromUtf8Error

source§

impl Eq for String

1.28.0 · source§

impl Eq for Layout

1.50.0 · source§

impl Eq for LayoutError

source§

impl Eq for AllocError

source§

impl Eq for TypeId

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

source§

impl Eq for CStr

1.69.0 · source§

impl Eq for FromBytesUntilNulError

1.64.0 · source§

impl Eq for FromBytesWithNulError

1.33.0 · source§

impl Eq for PhantomPinned

source§

impl Eq for Assume

source§

impl Eq for ParseFloatError

source§

impl Eq for ParseIntError

1.34.0 · source§

impl Eq for TryFromIntError

1.34.0 · source§

impl Eq for NonZeroI8

1.34.0 · source§

impl Eq for NonZeroI16

1.34.0 · source§

impl Eq for NonZeroI32

1.34.0 · source§

impl Eq for NonZeroI64

1.34.0 · source§

impl Eq for NonZeroI128

1.34.0 · source§

impl Eq for NonZeroIsize

1.28.0 · source§

impl Eq for NonZeroU8

1.28.0 · source§

impl Eq for NonZeroU16

1.28.0 · source§

impl Eq for NonZeroU32

1.28.0 · source§

impl Eq for NonZeroU64

1.28.0 · source§

impl Eq for NonZeroU128

1.28.0 · source§

impl Eq for NonZeroUsize

source§

impl Eq for RangeFull

source§

impl Eq for core::ptr::alignment::Alignment

1.66.0 · source§

impl Eq for TryFromFloatSecsError

source§

impl Eq for OsStr

source§

impl Eq for OsString

1.1.0 · source§

impl Eq for FileType

source§

impl Eq for Permissions

source§

impl Eq for UCred

source§

impl Eq for Components<'_>

1.7.0 · source§

impl Eq for StripPrefixError

source§

impl Eq for ExitStatus

source§

impl Eq for ExitStatusError

source§

impl Eq for Output

1.5.0 · source§

impl Eq for WaitTimeoutResult

source§

impl Eq for RecvError

1.26.0 · source§

impl Eq for AccessError

1.19.0 · source§

impl Eq for ThreadId

1.8.0 · source§

impl Eq for SystemTime

source§

impl Eq for ParseLevelError

source§

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

source§

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

source§

impl<'a> Eq for Query<'a>

source§

impl<'a> Eq for QueryPair<'a>

source§

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

1.10.0 · source§

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

source§

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

source§

impl<'a> Eq for Metadata<'a>

source§

impl<'a> Eq for MetadataBuilder<'a>

source§

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

source§

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

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.29.0 · source§

impl<H> Eq for BuildHasherDefault<H>

source§

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

source§

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

1.26.0 · source§

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

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<K, V, A> Eq for BTreeMap<K, V, A>where K: Eq, V: Eq, A: Allocator + Clone,

source§

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

1.41.0 · source§

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

1.4.0 · source§

impl<Ret, T> Eq for fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.4.0 · source§

impl<Ret, T> Eq for extern "C" fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.4.0 · source§

impl<Ret, T> Eq for extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

source§

impl<Ret, T> Eq for extern "C-unwind" fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

source§

impl<Ret, T> Eq for extern "C-unwind" fn (T₁, T₂, …, Tₙ, ...) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.4.0 · source§

impl<Ret, T> Eq for unsafe fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.4.0 · source§

impl<Ret, T> Eq for unsafe extern "C" fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.4.0 · source§

impl<Ret, T> Eq for unsafe extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

source§

impl<Ret, T> Eq for unsafe extern "C-unwind" fn (T₁, T₂, …, Tₙ) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

source§

impl<Ret, T> Eq for unsafe extern "C-unwind" fn (T₁, T₂, …, Tₙ, ...) -> Ret

This trait is implemented for function pointers with up to twelve arguments.

1.17.0 · source§

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

source§

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

1.36.0 · source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

1.2.0 · source§

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

1.2.0 · source§

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

source§

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

1.20.0 · source§

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

1.21.0 · source§

impl<T> Eq for Discriminant<T>

source§

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

source§

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

1.25.0 · source§

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

source§

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

source§

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

1.19.0 · source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

impl<T, const LANES: usize> Eq for Simd<T, LANES>where LaneCount<LANES>: SupportedLaneCount, T: SimdElement + Eq,

source§

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

source§

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