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
impliesb == a
anda != b
implies!(a == b)
- transitive:
a == b
andb == c
impliesa == 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 derive
d, 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§
impl Eq for PrivateInput
impl Eq for Dictionary
impl Eq for OffsetValue
impl Eq for BuiltinName
impl Eq for ApUpdate
impl Eq for FpUpdate
impl Eq for Op1Addr
impl Eq for Opcode
impl Eq for PcUpdate
impl Eq for Register
impl Eq for Res
impl Eq for LayoutName
impl Eq for MaybeRelocatable
impl Eq for CairoPieValidationError
impl Eq for ExecScopeError
impl Eq for InsufficientAllocatedCellsError
impl Eq for BuiltinAdditionalData
impl Eq for CairoArg
impl Eq for cairo_vm::with_std::cmp::Ordering
impl Eq for Infallible
impl Eq for cairo_vm::with_std::fmt::Alignment
impl Eq for FpCategory
impl Eq for IntErrorKind
impl Eq for SearchStep
impl Eq for cairo_vm::with_std::sync::atomic::Ordering
impl Eq for RecvTimeoutError
impl Eq for TryRecvError
impl Eq for alloc::collections::TryReserveErrorKind
impl Eq for AsciiChar
impl Eq for IpAddr
impl Eq for Ipv6MulticastScope
impl Eq for SocketAddr
impl Eq for BacktraceStatus
impl Eq for VarError
impl Eq for SeekFrom
impl Eq for std::io::error::ErrorKind
impl Eq for Shutdown
impl Eq for BacktraceStyle
impl Eq for allocator_api2::stable::raw_vec::TryReserveErrorKind
impl Eq for LegendreSymbol
impl Eq for Compress
impl Eq for Validate
impl Eq for ark_std::io::error::ErrorKind
impl Eq for AllowedEnumVariants
impl Eq for IntegerType
impl Eq for BigEndian
impl Eq for LittleEndian
impl Eq for FlushCompress
impl Eq for FlushDecompress
impl Eq for Status
impl Eq for hashbrown::TryReserveError
impl Eq for EllipticCurveError
impl Eq for ByteConversionError
impl Eq for CreationError
impl Eq for DeserializationError
impl Eq for PairingError
impl Eq for CompressionStrategy
impl Eq for TDEFLFlush
impl Eq for TDEFLStatus
impl Eq for CompressionLevel
impl Eq for DataFormat
impl Eq for MZError
impl Eq for MZFlush
impl Eq for MZStatus
impl Eq for TINFLStatus
impl Eq for nom::error::ErrorKind
impl Eq for Needed
impl Eq for Endianness
impl Eq for Sign
impl Eq for BernoulliError
impl Eq for WeightedError
impl Eq for RoundingStrategy
impl Eq for Category
impl Eq for Value
impl Eq for CurveError
impl Eq for CompressionMethod
impl Eq for bool
impl Eq for char
impl Eq for i8
impl Eq for i16
impl Eq for i32
impl Eq for i64
impl Eq for i128
impl Eq for isize
impl Eq for !
impl Eq for str
impl Eq for u8
impl Eq for u16
impl Eq for u32
impl Eq for u64
impl Eq for u128
impl Eq for ()
impl Eq for usize
impl Eq for AirPrivateInput
impl Eq for AirPrivateInputSerializable
impl Eq for ModInput
impl Eq for ModInputInstance
impl Eq for ModInputMemoryVars
impl Eq for PrivateInputEcOp
impl Eq for PrivateInputKeccakState
impl Eq for PrivateInputPair
impl Eq for PrivateInputPoseidonState
impl Eq for PrivateInputSignature
impl Eq for PrivateInputValue
impl Eq for SignatureInput
impl Eq for DictManager
impl Eq for DictTracker
impl Eq for HintReference
impl Eq for ApTracking
impl Eq for Attribute
impl Eq for DebugInfo
impl Eq for FlowTrackingData
impl Eq for HintLocation
impl Eq for HintParams
impl Eq for Identifier
impl Eq for InputFile
impl Eq for InstructionLocation
impl Eq for cairo_vm::serde::deserialize_program::Location
impl Eq for Member
impl Eq for Reference
impl Eq for ReferenceManager
impl Eq for ValueAddress
impl Eq for Felt
impl Eq for Instruction
impl Eq for Program
impl Eq for Relocatable
impl Eq for CairoPie
impl Eq for CairoPieAdditionalData
impl Eq for CairoPieMemory
impl Eq for CairoPieMetadata
impl Eq for CairoPieVersion
impl Eq for OutputBuiltinAdditionalData
impl Eq for PublicMemoryPage
impl Eq for cairo_vm::vm::runners::cairo_pie::SegmentInfo
impl Eq for StrippedProgram
impl Eq for ExecutionResources
impl Eq for cairo_vm::vm::runners::cairo_runner::SegmentInfo
impl Eq for RelocatedTraceEntry
impl Eq for TraceEntry
impl Eq for Operands
impl Eq for OperandsAddresses
impl Eq for cairo_vm::with_std::alloc::AllocError
impl Eq for Layout
impl Eq for LayoutError
impl Eq for TypeId
impl Eq for cairo_vm::with_std::fmt::Error
impl Eq for PhantomPinned
impl Eq for Assume
impl Eq for ParseFloatError
impl Eq for ParseIntError
impl Eq for TryFromIntError
impl Eq for RangeFull
impl Eq for cairo_vm::with_std::ptr::Alignment
impl Eq for ParseBoolError
impl Eq for Utf8Error
impl Eq for FromUtf8Error
impl Eq for RecvError
impl Eq for WaitTimeoutResult
impl Eq for Duration
impl Eq for TryFromFloatSecsError
impl Eq for UnorderedKeyError
impl Eq for alloc::collections::TryReserveError
impl Eq for CString
impl Eq for FromVecWithNulError
impl Eq for IntoStringError
impl Eq for NulError
impl Eq for CharTryFromError
impl Eq for ParseCharError
impl Eq for DecodeUtf16Error
impl Eq for TryFromCharError
impl Eq for CpuidResult
impl Eq for CStr
impl Eq for FromBytesUntilNulError
impl Eq for FromBytesWithNulError
impl Eq for Ipv4Addr
impl Eq for Ipv6Addr
impl Eq for AddrParseError
impl Eq for SocketAddrV4
impl Eq for SocketAddrV6
impl Eq for OsStr
impl Eq for OsString
impl Eq for FileType
impl Eq for Permissions
impl Eq for UCred
impl Eq for Components<'_>
impl Eq for Path
impl Eq for PathBuf
impl Eq for StripPrefixError
impl Eq for ExitStatus
impl Eq for ExitStatusError
impl Eq for Output
impl Eq for AccessError
impl Eq for ThreadId
impl Eq for Instant
impl Eq for SystemTime
impl Eq for allocator_api2::stable::alloc::AllocError
impl Eq for allocator_api2::stable::raw_vec::TryReserveError
impl Eq for EmptyFlags
impl Eq for Lsb0
impl Eq for Msb0
impl Eq for block_buffer::Error
impl Eq for Limb
impl Eq for Reciprocal
impl Eq for InvalidLength
impl Eq for MacError
impl Eq for InvalidBufferSize
impl Eq for Compression
impl Eq for getrandom::error::Error
impl Eq for MontgomeryConfigBabybear31PrimeField
impl Eq for MontgomeryConfigU64GoldilocksPrimeField
impl Eq for MontgomeryConfigMersenne31PrimeField
impl Eq for Mersenne31Field
impl Eq for P448GoldilocksPrimeField
impl Eq for U56x8
impl Eq for MontgomeryConfigPallas255PrimeField
impl Eq for Goldilocks64Field
impl Eq for MontgomeryConfigVesta255PrimeField
impl Eq for StreamResult
impl Eq for num_bigint::bigint::BigInt
impl Eq for BigUint
impl Eq for ParseBigIntError
impl Eq for udouble
impl Eq for StepRng
impl Eq for SmallRng
impl Eq for StdRng
impl Eq for ChaCha8Core
impl Eq for ChaCha8Rng
impl Eq for ChaCha12Core
impl Eq for ChaCha12Rng
impl Eq for ChaCha20Core
impl Eq for ChaCha20Rng
impl Eq for Decimal
impl Eq for Map<String, Value>
impl Eq for Number
impl Eq for starknet_curve::ec_point::AffinePoint
impl Eq for starknet_curve::ec_point::ProjectivePoint
impl Eq for starknet_ff::FieldElement
impl Eq for starknet_types_core::curve::affine_point::AffinePoint
impl Eq for starknet_types_core::curve::projective_point::ProjectivePoint
impl Eq for NonZeroFelt
impl Eq for ATerm
impl Eq for B0
impl Eq for B1
impl Eq for Z0
impl Eq for Equal
impl Eq for Greater
impl Eq for Less
impl Eq for UTerm
impl Eq for Const
impl Eq for Mut
impl Eq for NullPtrError
impl Eq for String
impl Eq for vec128_storage
impl Eq for vec256_storage
impl Eq for vec512_storage
impl<'a> Eq for Utf8Pattern<'a>
impl<'a> Eq for Component<'a>
impl<'a> Eq for Prefix<'a>
impl<'a> Eq for Utf8Chunk<'a>
impl<'a> Eq for core::panic::location::Location<'a>
impl<'a> Eq for PrefixComponent<'a>
impl<'a, T, O> Eq for IterOnes<'a, T, O>
impl<'a, T, O> Eq for IterZeros<'a, T, O>
impl<A> Eq for &A
impl<A> Eq for &mut A
impl<A> Eq for ExtendedGcd<A>where
A: Eq,
impl<A, O> Eq for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
impl<B> Eq for Cow<'_, B>
impl<B, C> Eq for ControlFlow<B, C>
impl<Dyn> Eq for DynMetadata<Dyn>where
Dyn: ?Sized,
impl<E> Eq for Err<E>where
E: Eq,
impl<E> Eq for EdwardsProjectivePoint<E>where
E: IsEllipticCurve,
impl<E> Eq for MontgomeryProjectivePoint<E>where
E: IsEllipticCurve,
impl<E> Eq for lambdaworks_math::elliptic_curve::point::ProjectivePoint<E>where
E: IsEllipticCurve,
impl<E> Eq for ShortWeierstrassProjectivePoint<E>where
E: IsEllipticCurve,
impl<F> Eq for lambdaworks_math::field::element::FieldElement<F>where
F: IsField,
impl<F> Eq for Fwhere
F: FnPtr,
impl<F, T> Eq for CubicExtensionField<F, T>
impl<F, T> Eq for QuadraticExtensionField<F, T>
impl<FE> Eq for Polynomial<FE>where
FE: Eq,
impl<H> Eq for BuildHasherDefault<H>
impl<Idx> Eq for cairo_vm::with_std::ops::Range<Idx>where
Idx: Eq,
impl<Idx> Eq for cairo_vm::with_std::ops::RangeFrom<Idx>where
Idx: Eq,
impl<Idx> Eq for cairo_vm::with_std::ops::RangeInclusive<Idx>where
Idx: Eq,
impl<Idx> Eq for RangeTo<Idx>where
Idx: Eq,
impl<Idx> Eq for RangeToInclusive<Idx>where
Idx: Eq,
impl<Idx> Eq for core::range::Range<Idx>where
Idx: Eq,
impl<Idx> Eq for core::range::RangeFrom<Idx>where
Idx: Eq,
impl<Idx> Eq for core::range::RangeInclusive<Idx>where
Idx: Eq,
impl<Inner> Eq for Frozen<Inner>where
Inner: Eq + Mutability,
impl<K, V, A> Eq for BTreeMap<K, V, A>
impl<K, V, S> Eq for cairo_vm::with_std::collections::HashMap<K, V, S>
impl<K, V, S, A> Eq for hashbrown::map::HashMap<K, V, S, A>
impl<L, R> Eq for Either<L, R>
impl<M, T> Eq for Address<M, T>where
M: Mutability,
impl<M, T, O> Eq for BitRef<'_, M, T, O>
impl<M, T, O> Eq for BitPtrRange<M, T, O>
impl<M, T, O> Eq for BitPtr<M, T, O>
impl<MOD, const LIMBS: usize> Eq for Residue<MOD, LIMBS>where
MOD: Eq + ResidueParams<LIMBS>,
impl<O> Eq for F32<O>where
O: Eq,
impl<O> Eq for F64<O>where
O: Eq,
impl<O> Eq for I16<O>where
O: Eq,
impl<O> Eq for I32<O>where
O: Eq,
impl<O> Eq for I64<O>where
O: Eq,
impl<O> Eq for I128<O>where
O: Eq,
impl<O> Eq for U16<O>where
O: Eq,
impl<O> Eq for U32<O>where
O: Eq,
impl<O> Eq for U64<O>where
O: Eq,
impl<O> Eq for U128<O>where
O: Eq,
impl<P> Eq for CubicExtField<P>where
P: CubicExtConfig,
impl<P> Eq for QuadExtField<P>where
P: QuadExtConfig,
impl<P, const N: usize> Eq for Fp<P, N>where
P: FpConfig<N>,
impl<Ptr> Eq for Pin<Ptr>
impl<R> Eq for BitEnd<R>where
R: Eq + BitRegister,
impl<R> Eq for BitIdx<R>where
R: Eq + BitRegister,
impl<R> Eq for BitIdxError<R>where
R: Eq + BitRegister,
impl<R> Eq for BitMask<R>where
R: Eq + BitRegister,
impl<R> Eq for BitPos<R>where
R: Eq + BitRegister,
impl<R> Eq for BitSel<R>where
R: Eq + BitRegister,
impl<T> Eq for Bound<T>where
T: Eq,
impl<T> Eq for SendTimeoutError<T>where
T: Eq,
impl<T> Eq for TrySendError<T>where
T: Eq,
impl<T> Eq for Option<T>where
T: Eq,
impl<T> Eq for Poll<T>where
T: Eq,
impl<T> Eq for BitPtrError<T>
impl<T> Eq for BitSpanError<T>
impl<T> Eq for *const Twhere
T: ?Sized,
impl<T> Eq for *mut Twhere
T: ?Sized,
impl<T> Eq for [T]where
T: Eq,
impl<T> Eq for (T₁, T₂, …, Tₙ)
This trait is implemented for tuples up to twelve items long.