Trait gstd::prelude::cmp::Eq

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

Trait for comparisons corresponding to equivalence relations.

This means, that in addition to a == b and a != b being strict inverses, the relation must be (for all a, b and c):

  • reflexive: a == a;
  • symmetric: a == b implies b == a (required by PartialEq as well); and
  • transitive: a == b and b == c implies a == c (required by PartialEq as well).

This property cannot be checked by the compiler, and therefore Eq implies PartialEq, and has no extra 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.

Implement Eq in addition to PartialEq if it’s guaranteed that PartialEq::eq(a, a) always returns true (reflexivity), in addition to the symmetric and transitive properties already required by PartialEq.

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

Object Safety§

This trait is not object safe.

Implementors§

§

impl Eq for ConversionError

source§

impl Eq for gstd::errors::CoreError

source§

impl Eq for gstd::errors::Error

source§

impl Eq for ErrorReplyReason

source§

impl Eq for ExecutionError

source§

impl Eq for ExtError

source§

impl Eq for MemoryError

source§

impl Eq for MessageError

source§

impl Eq for ReplyCode

source§

impl Eq for ReservationError

source§

impl Eq for SignalCode

source§

impl Eq for SimpleExecutionError

source§

impl Eq for SimpleProgramCreationError

source§

impl Eq for SuccessReplyReason

source§

impl Eq for UsageError

source§

impl Eq for AsciiChar

source§

impl Eq for TryReserveErrorKind

§

impl Eq for gstd::prelude::collections::hashbrown::TryReserveError

1.34.0 · source§

impl Eq for Infallible

1.28.0 · source§

impl Eq for gstd::prelude::fmt::Alignment

1.0.0 · source§

impl Eq for FpCategory

1.55.0 · source§

impl Eq for IntErrorKind

source§

impl Eq for SearchStep

1.0.0 · source§

impl Eq for gstd::prelude::cmp::Ordering

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 core::sync::atomic::Ordering

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

§

impl Eq for gstd::errors::CodecError

source§

impl Eq for ErrorReplyPayload

source§

impl Eq for SyscallError

source§

impl Eq for gstd::msg::MessageHandle

§

impl Eq for ActorId

§

impl Eq for CodeId

§

impl Eq for MessageId

§

impl Eq for Percent

§

impl Eq for ReservationId

§

impl Eq for MetaType

1.0.0 · source§

impl Eq for TypeId

1.34.0 · source§

impl Eq for CharTryFromError

1.9.0 · source§

impl Eq for DecodeUtf16Error

1.20.0 · source§

impl Eq for ParseCharError

1.59.0 · source§

impl Eq for TryFromCharError

source§

impl Eq for UnorderedKeyError

1.57.0 · source§

impl Eq for gstd::prelude::collections::TryReserveError

1.64.0 · source§

impl Eq for CStr

1.64.0 · source§

impl Eq for CString

1.69.0 · source§

impl Eq for FromBytesUntilNulError

1.64.0 · source§

impl Eq for FromBytesWithNulError

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

impl Eq for gstd::prelude::fmt::Error

1.33.0 · source§

impl Eq for PhantomPinned

source§

impl Eq for Assume

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

impl Eq for RangeFull

source§

impl Eq for gstd::prelude::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.0.0 · source§

impl Eq for String

1.3.0 · source§

impl Eq for Duration

1.66.0 · source§

impl Eq for TryFromFloatSecsError

1.28.0 · source§

impl Eq for Layout

1.50.0 · source§

impl Eq for LayoutError

source§

impl Eq for core::alloc::AllocError

1.27.0 · source§

impl Eq for CpuidResult

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

source§

impl Eq for ATerm

source§

impl Eq for B0

source§

impl Eq for B1

source§

impl Eq for Z0

source§

impl Eq for Equal

source§

impl Eq for Greater

source§

impl Eq for Less

source§

impl Eq for UTerm

§

impl Eq for Aborted

§

impl Eq for AllocError

§

impl Eq for BigEndian

§

impl Eq for Canceled

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for Error

§

impl Eq for FromStrRadixErrKind

§

impl Eq for H128

§

impl Eq for H160

§

impl Eq for H256

§

impl Eq for H384

§

impl Eq for H512

§

impl Eq for H768

§

impl Eq for InvalidBufferSize

§

impl Eq for InvalidLength

§

impl Eq for LittleEndian

§

impl Eq for MacError

§

impl Eq for MessageHandle

§

impl Eq for MetaForm

§

impl Eq for NonZeroU256

§

impl Eq for OptionBool

§

impl Eq for PathError

§

impl Eq for PollNext

§

impl Eq for PortableForm

§

impl Eq for PortableRegistry

§

impl Eq for PortableType

§

impl Eq for Registry

§

impl Eq for TypeDefPrimitive

§

impl Eq for U128

§

impl Eq for U256

§

impl Eq for U512

1.10.0 · source§

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

1.79.0 · source§

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

§

impl<'a, T> Eq for CompactRef<'a, T>
where T: Eq,

§

impl<'a, T> Eq for Symbol<'a, T>
where T: Eq + '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,

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 gstd::prelude::ops::Range<Idx>
where Idx: Eq,

1.0.0 · source§

impl<Idx> Eq for gstd::prelude::ops::RangeFrom<Idx>
where Idx: Eq,

1.26.0 · source§

impl<Idx> Eq for gstd::prelude::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,

§

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,

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 gstd::prelude::cell::OnceCell<T>
where T: Eq,

1.2.0 · source§

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

1.0.0 · source§

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

1.21.0 · source§

impl<T> Eq for Discriminant<T>

1.20.0 · source§

impl<T> Eq for ManuallyDrop<T>
where T: Eq + ?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.25.0 · source§

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

source§

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

1.19.0 · source§

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

§

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

§

impl<T> Eq for CtOutput<T>
where T: OutputSizeUser,

§

impl<T> Eq for Field<T>
where T: Eq + Form, <T as Form>::String: Eq, <T as Form>::Type: Eq,

§

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

§

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

§

impl<T> Eq for Path<T>
where T: Eq + Form, <T as Form>::String: Eq,

§

impl<T> Eq for Type<T>
where T: Eq + Form, <T as Form>::String: Eq,

§

impl<T> Eq for TypeDef<T>
where T: Eq + Form,

§

impl<T> Eq for TypeDefArray<T>
where T: Eq + Form, <T as Form>::Type: Eq,

§

impl<T> Eq for TypeDefBitSequence<T>
where T: Eq + Form, <T as Form>::Type: Eq,

§

impl<T> Eq for TypeDefCompact<T>
where T: Eq + Form, <T as Form>::Type: Eq,

§

impl<T> Eq for TypeDefComposite<T>
where T: Eq + Form,

§

impl<T> Eq for TypeDefSequence<T>
where T: Eq + Form, <T as Form>::Type: Eq,

§

impl<T> Eq for TypeDefTuple<T>
where T: Eq + Form, <T as Form>::Type: Eq,

§

impl<T> Eq for TypeDefVariant<T>
where T: Eq + Form,

§

impl<T> Eq for TypeParameter<T>
where T: Eq + Form, <T as Form>::String: Eq, <T as Form>::Type: Eq,

§

impl<T> Eq for Unalign<T>
where T: Unaligned + Eq,

§

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

§

impl<T> Eq for Variant<T>
where T: Eq + Form, <T as Form>::String: Eq,

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,

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 gstd::prelude::Box<T, A>
where T: Eq + ?Sized, A: Allocator,

1.0.0 · source§

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

1.0.0 · source§

impl<T, A> Eq for Arc<T, A>
where T: Eq + ?Sized, 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,

§

impl<T, B> Eq for Ref<B, [T]>
where B: ByteSlice, T: FromBytes + Eq,

§

impl<T, B> Eq for Ref<B, T>
where B: ByteSlice, T: FromBytes + Eq,

1.0.0 · source§

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

§

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

§

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

§

impl<T, N> Eq for GenericArray<T, N>
where T: Eq, N: ArrayLength<T>,

§

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

source§

impl<T, const CAP: usize> Eq for ArrayVec<T, CAP>
where T: Eq,

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<U> Eq for NInt<U>
where U: Eq + Unsigned + NonZero,

source§

impl<U> Eq for PInt<U>
where U: Eq + Unsigned + NonZero,

source§

impl<U, B> Eq for UInt<U, B>
where U: Eq, B: Eq,

source§

impl<V, A> Eq for TArr<V, A>
where V: Eq, A: Eq,

source§

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

source§

impl<const CAP: usize> Eq for ArrayString<CAP>