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
impliesb == a
(required byPartialEq
as well); and - transitive:
a == b
andb == c
impliesa == c
(required byPartialEq
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 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 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§
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 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 cairo_vm::with_std::cmp::Ordering
impl Eq for 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 LegendreSymbol
impl Eq for Compress
impl Eq for Validate
impl Eq for ark_std::io::error::ErrorKind
impl Eq for base64ct::errors::Error
impl Eq for LineEnding
impl Eq for AllowedEnumVariants
impl Eq for IntegerType
impl Eq for BigEndian
impl Eq for LittleEndian
impl Eq for Action
impl Eq for bzip2::mem::Error
impl Eq for bzip2::mem::Status
impl Eq for FlushCompress
impl Eq for FlushDecompress
impl Eq for flate2::mem::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 Encoding
impl Eq for password_hash::errors::Error
impl Eq for InvalidValue
impl Eq for Algorithm
impl Eq for BernoulliError
impl Eq for WeightedError
impl Eq for RoundingStrategy
impl Eq for Category
impl Eq for serde_json::value::Value
impl Eq for CurveError
impl Eq for Month
impl Eq for Weekday
impl Eq for CompressionMethod
impl Eq for CParameter
impl Eq for ZSTD_EndDirective
impl Eq for ZSTD_ResetDirective
impl Eq for ZSTD_cParameter
impl Eq for ZSTD_dParameter
impl Eq for ZSTD_strategy
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 String
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 cairo_vm::with_std::num::ParseIntError
impl Eq for cairo_vm::with_std::num::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 cairo_vm::with_std::time::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 std::process::Output
impl Eq for AccessError
impl Eq for ThreadId
impl Eq for std::time::Instant
impl Eq for SystemTime
impl Eq for allocator_api2::stable::alloc::AllocError
impl Eq for EmptyFlags
impl Eq for Base64Bcrypt
impl Eq for Base64Crypt
impl Eq for Base64ShaCrypt
impl Eq for Base64
impl Eq for Base64Unpadded
impl Eq for Base64Url
impl Eq for Base64UrlUnpadded
impl Eq for InvalidEncodingError
impl Eq for InvalidLengthError
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 deranged::ParseIntError
impl Eq for deranged::TryFromIntError
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 password_hash::output::Output
impl Eq for ParamsString
impl Eq for SaltString
impl Eq for Params
impl Eq for Pbkdf2
impl Eq for vec256_storage
impl Eq for vec512_storage
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 Date
impl Eq for time::duration::Duration
impl Eq for ComponentRange
impl Eq for ConversionRange
impl Eq for DifferentVariant
impl Eq for InvalidVariant
impl Eq for time::instant::Instant
impl Eq for OffsetDateTime
impl Eq for PrimitiveDateTime
impl Eq for Time
impl Eq for UtcOffset
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 vec128_storage
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> Eq for Ident<'a>
impl<'a> Eq for Salt<'a>
impl<'a> Eq for PasswordHash<'a>
impl<'a> Eq for password_hash::value::Value<'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<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 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.