Trait scale_info::prelude::cmp::PartialEq
1.0.0 · source · pub trait PartialEq<Rhs = Self>where
Rhs: ?Sized,{
fn eq(&self, other: &Rhs) -> bool;
fn ne(&self, other: &Rhs) -> bool { ... }
}
Expand description
Trait for equality comparisons which are partial equivalence relations.
x.eq(y)
can also be written x == y
, and x.ne(y)
can be written x != y
.
We use the easier-to-read infix notation in the remainder of this documentation.
This trait allows for partial equality, for types that do not have a full
equivalence relation. For example, in floating point numbers NaN != NaN
,
so floating point types implement PartialEq
but not Eq
.
Implementations must ensure that eq
and ne
are consistent with each other:
a != b
if and only if!(a == b)
.
The default implementation of ne
provides this consistency and is almost
always sufficient. It should not be overridden without very good reason.
If PartialOrd
or Ord
are also implemented for Self
and Rhs
, their methods must also
be consistent with PartialEq
(see the documentation of those traits for the exact
requirements). It’s easy to accidentally make them disagree by deriving some of the traits and
manually implementing others.
The equality relation ==
must satisfy the following conditions
(for all a
, b
, c
of type A
, B
, C
):
-
Symmetric: if
A: PartialEq<B>
andB: PartialEq<A>
, thena == b
impliesb == a
; and -
Transitive: if
A: PartialEq<B>
andB: PartialEq<C>
andA: PartialEq<C>
, thena == b
andb == c
impliesa == c
.
Note that the B: PartialEq<A>
(symmetric) and A: PartialEq<C>
(transitive) impls are not forced to exist, but these requirements apply
whenever they do exist.
Derivable
This trait can be used with #[derive]
. When derive
d on structs, two
instances are equal if all fields are equal, and not equal if any fields
are not equal. When derive
d on enums, two instances are equal if they
are the same variant and all fields are equal.
How can I implement PartialEq
?
An example implementation for a domain in which two books are considered the same book if their ISBN matches, even if the formats differ:
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
}
}
let b1 = Book { isbn: 3, format: BookFormat::Paperback };
let b2 = Book { isbn: 3, format: BookFormat::Ebook };
let b3 = Book { isbn: 10, format: BookFormat::Paperback };
assert!(b1 == b2);
assert!(b1 != b3);
How can I compare two different types?
The type you can compare with is controlled by PartialEq
’s type parameter.
For example, let’s tweak our previous code a bit:
// The derive implements <BookFormat> == <BookFormat> comparisons
#[derive(PartialEq)]
enum BookFormat {
Paperback,
Hardback,
Ebook,
}
struct Book {
isbn: i32,
format: BookFormat,
}
// Implement <Book> == <BookFormat> comparisons
impl PartialEq<BookFormat> for Book {
fn eq(&self, other: &BookFormat) -> bool {
self.format == *other
}
}
// Implement <BookFormat> == <Book> comparisons
impl PartialEq<Book> for BookFormat {
fn eq(&self, other: &Book) -> bool {
*self == other.format
}
}
let b1 = Book { isbn: 3, format: BookFormat::Paperback };
assert!(b1 == BookFormat::Paperback);
assert!(BookFormat::Ebook != b1);
By changing impl PartialEq for Book
to impl PartialEq<BookFormat> for Book
,
we allow BookFormat
s to be compared with Book
s.
A comparison like the one above, which ignores some fields of the struct,
can be dangerous. It can easily lead to an unintended violation of the
requirements for a partial equivalence relation. For example, if we kept
the above implementation of PartialEq<Book>
for BookFormat
and added an
implementation of PartialEq<Book>
for Book
(either via a #[derive]
or
via the manual implementation from the first example) then the result would
violate transitivity:
#[derive(PartialEq)]
enum BookFormat {
Paperback,
Hardback,
Ebook,
}
#[derive(PartialEq)]
struct Book {
isbn: i32,
format: BookFormat,
}
impl PartialEq<BookFormat> for Book {
fn eq(&self, other: &BookFormat) -> bool {
self.format == *other
}
}
impl PartialEq<Book> for BookFormat {
fn eq(&self, other: &Book) -> bool {
*self == other.format
}
}
fn main() {
let b1 = Book { isbn: 1, format: BookFormat::Paperback };
let b2 = Book { isbn: 2, format: BookFormat::Paperback };
assert!(b1 == BookFormat::Paperback);
assert!(BookFormat::Paperback == b2);
// The following should hold by transitivity but doesn't.
assert!(b1 == b2); // <-- PANICS
}
Examples
let x: u32 = 0;
let y: u32 = 1;
assert_eq!(x == y, false);
assert_eq!(x.eq(&y), false);
Required Methods§
Provided Methods§
Implementors§
impl PartialEq<&str> for OsString
impl PartialEq<Error> for byte_slice_cast::Error
impl PartialEq<PathError> for PathError
impl PartialEq<TypeDefPrimitive> for TypeDefPrimitive
impl PartialEq<MetaForm> for MetaForm
impl PartialEq<PortableForm> for PortableForm
impl PartialEq<TryReserveErrorKind> for TryReserveErrorKind
impl PartialEq<Alignment> for scale_info::prelude::fmt::Alignment
impl PartialEq<FpCategory> for FpCategory
impl PartialEq<IntErrorKind> for IntErrorKind
impl PartialEq<Ordering> for scale_info::prelude::cmp::Ordering
impl PartialEq<Infallible> for Infallible
impl PartialEq<Which> for Which
impl PartialEq<SearchStep> for SearchStep
impl PartialEq<Ordering> for core::sync::atomic::Ordering
impl PartialEq<BacktraceStatus> for BacktraceStatus
impl PartialEq<VarError> for VarError
impl PartialEq<SeekFrom> for SeekFrom
impl PartialEq<ErrorKind> for ErrorKind
impl PartialEq<Shutdown> for Shutdown
impl PartialEq<IpAddr> for IpAddr
impl PartialEq<IpAddr> for Ipv4Addr
impl PartialEq<IpAddr> for Ipv6Addr
impl PartialEq<Ipv6MulticastScope> for Ipv6MulticastScope
impl PartialEq<SocketAddr> for SocketAddr
impl PartialEq<BacktraceStyle> for BacktraceStyle
impl PartialEq<RecvTimeoutError> for RecvTimeoutError
impl PartialEq<TryRecvError> for TryRecvError
impl PartialEq<_Unwind_Action> for _Unwind_Action
impl PartialEq<_Unwind_Reason_Code> for _Unwind_Reason_Code
impl PartialEq<bool> for bool
impl PartialEq<char> for char
impl PartialEq<f32> for f32
impl PartialEq<f64> for f64
impl PartialEq<i8> for i8
impl PartialEq<i16> for i16
impl PartialEq<i32> for i32
impl PartialEq<i64> for i64
impl PartialEq<i128> for i128
impl PartialEq<isize> for isize
impl PartialEq<!> for !
impl PartialEq<str> for str
impl PartialEq<str> for Bytes
impl PartialEq<str> for BytesMut
impl PartialEq<str> for OsStr
impl PartialEq<str> for OsString
impl PartialEq<u8> for u8
impl PartialEq<u16> for u16
impl PartialEq<u32> for u32
impl PartialEq<u64> for u64
impl PartialEq<u128> for u128
impl PartialEq<()> for ()
impl PartialEq<usize> for usize
impl PartialEq<Lsb0> for Lsb0
impl PartialEq<Msb0> for Msb0
impl PartialEq<Bytes> for &str
impl PartialEq<Bytes> for &[u8]
impl PartialEq<Bytes> for str
impl PartialEq<Bytes> for Bytes
impl PartialEq<Bytes> for BytesMut
impl PartialEq<Bytes> for String
impl PartialEq<Bytes> for Vec<u8, Global>
impl PartialEq<Bytes> for [u8]
impl PartialEq<BytesMut> for &str
impl PartialEq<BytesMut> for &[u8]
impl PartialEq<BytesMut> for str
impl PartialEq<BytesMut> for Bytes
impl PartialEq<BytesMut> for BytesMut
impl PartialEq<BytesMut> for String
impl PartialEq<BytesMut> for Vec<u8, Global>
impl PartialEq<BytesMut> for [u8]
impl PartialEq<OptionBool> for OptionBool
impl PartialEq<Error> for parity_scale_codec::error::Error
impl PartialEq<Error> for serde::de::value::Error
impl PartialEq<Const> for Const
impl PartialEq<Mut> for Mut
impl PartialEq<NullPtrError> for NullPtrError
impl PartialEq<MetaType> for MetaType
impl PartialEq<PortableRegistry> for PortableRegistry
impl PartialEq<Registry> for Registry
impl PartialEq<TypeId> for TypeId
impl PartialEq<TryReserveError> for TryReserveError
impl PartialEq<Error> for scale_info::prelude::fmt::Error
impl PartialEq<PhantomPinned> for PhantomPinned
impl PartialEq<Assume> for Assume
impl PartialEq<NonZeroI8> for NonZeroI8
impl PartialEq<NonZeroI16> for NonZeroI16
impl PartialEq<NonZeroI32> for NonZeroI32
impl PartialEq<NonZeroI64> for NonZeroI64
impl PartialEq<NonZeroI128> for NonZeroI128
impl PartialEq<NonZeroIsize> for NonZeroIsize
impl PartialEq<NonZeroU8> for NonZeroU8
impl PartialEq<NonZeroU16> for NonZeroU16
impl PartialEq<NonZeroU32> for NonZeroU32
impl PartialEq<NonZeroU64> for NonZeroU64
impl PartialEq<NonZeroU128> for NonZeroU128
impl PartialEq<NonZeroUsize> for NonZeroUsize
impl PartialEq<ParseFloatError> for ParseFloatError
impl PartialEq<ParseIntError> for ParseIntError
impl PartialEq<TryFromIntError> for TryFromIntError
impl PartialEq<RangeFull> for RangeFull
impl PartialEq<FromUtf8Error> for FromUtf8Error
impl PartialEq<String> for Bytes
impl PartialEq<String> for BytesMut
impl PartialEq<String> for String
impl PartialEq<Vec<u8, Global>> for Bytes
impl PartialEq<Vec<u8, Global>> for BytesMut
impl PartialEq<CString> for CString
impl PartialEq<FromVecWithNulError> for FromVecWithNulError
impl PartialEq<IntoStringError> for IntoStringError
impl PartialEq<NulError> for NulError
impl PartialEq<Layout> for Layout
impl PartialEq<LayoutError> for LayoutError
impl PartialEq<AllocError> for AllocError
impl PartialEq<CharTryFromError> for CharTryFromError
impl PartialEq<ParseCharError> for ParseCharError
impl PartialEq<DecodeUtf16Error> for DecodeUtf16Error
impl PartialEq<TryFromCharError> for TryFromCharError
impl PartialEq<CpuidResult> for CpuidResult
impl PartialEq<CStr> for CStr
impl PartialEq<FromBytesUntilNulError> for FromBytesUntilNulError
impl PartialEq<FromBytesWithNulError> for FromBytesWithNulError
impl PartialEq<Alignment> for core::ptr::alignment::Alignment
impl PartialEq<ParseBoolError> for ParseBoolError
impl PartialEq<Utf8Error> for Utf8Error
impl PartialEq<RawWaker> for RawWaker
impl PartialEq<RawWakerVTable> for RawWakerVTable
impl PartialEq<Duration> for Duration
impl PartialEq<TryFromFloatSecsError> for TryFromFloatSecsError
impl PartialEq<OsStr> for str
impl PartialEq<OsStr> for OsStr
impl PartialEq<OsString> for str
impl PartialEq<OsString> for OsString
impl PartialEq<FileType> for FileType
impl PartialEq<Permissions> for Permissions
impl PartialEq<Ipv4Addr> for IpAddr
impl PartialEq<Ipv4Addr> for Ipv4Addr
impl PartialEq<Ipv6Addr> for IpAddr
impl PartialEq<Ipv6Addr> for Ipv6Addr
impl PartialEq<AddrParseError> for AddrParseError
impl PartialEq<SocketAddrV4> for SocketAddrV4
impl PartialEq<SocketAddrV6> for SocketAddrV6
impl PartialEq<UCred> for UCred
impl PartialEq<Path> for std::path::Path
impl PartialEq<PathBuf> for PathBuf
impl PartialEq<StripPrefixError> for StripPrefixError
impl PartialEq<ExitStatus> for ExitStatus
impl PartialEq<ExitStatusError> for ExitStatusError
impl PartialEq<Output> for Output
impl PartialEq<WaitTimeoutResult> for WaitTimeoutResult
impl PartialEq<RecvError> for RecvError
impl PartialEq<AccessError> for AccessError
impl PartialEq<ThreadId> for ThreadId
impl PartialEq<Instant> for Instant
impl PartialEq<SystemTime> for SystemTime
impl PartialEq<[u8]> for Bytes
impl PartialEq<[u8]> for BytesMut
impl<'a> PartialEq<Unexpected<'a>> for Unexpected<'a>
impl<'a> PartialEq<Component<'a>> for Component<'a>
impl<'a> PartialEq<Prefix<'a>> for Prefix<'a>
impl<'a> PartialEq<Location<'a>> for Location<'a>
impl<'a> PartialEq<Utf8Chunk<'a>> for Utf8Chunk<'a>
impl<'a> PartialEq<OsString> for &'a str
impl<'a> PartialEq<Components<'a>> for Components<'a>
impl<'a> PartialEq<PrefixComponent<'a>> for PrefixComponent<'a>
impl<'a, 'b> PartialEq<&'a str> for String
impl<'a, 'b> PartialEq<&'a OsStr> for OsString
impl<'a, 'b> PartialEq<&'a OsStr> for std::path::Path
impl<'a, 'b> PartialEq<&'a OsStr> for PathBuf
impl<'a, 'b> PartialEq<&'a Path> for Cow<'b, OsStr>
impl<'a, 'b> PartialEq<&'a Path> for OsStr
impl<'a, 'b> PartialEq<&'a Path> for OsString
impl<'a, 'b> PartialEq<&'a Path> for PathBuf
impl<'a, 'b> PartialEq<&'b str> for Cow<'a, str>
impl<'a, 'b> PartialEq<&'b OsStr> for Cow<'a, OsStr>
impl<'a, 'b> PartialEq<&'b OsStr> for Cow<'a, Path>
impl<'a, 'b> PartialEq<&'b Path> for Cow<'a, Path>
impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b str
impl<'a, 'b> PartialEq<Cow<'a, str>> for str
impl<'a, 'b> PartialEq<Cow<'a, str>> for String
impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for &'b OsStr
impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for OsStr
impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for OsString
impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for std::path::Path
impl<'a, 'b> PartialEq<Cow<'a, OsStr>> for PathBuf
impl<'a, 'b> PartialEq<Cow<'a, Path>> for &'b OsStr
impl<'a, 'b> PartialEq<Cow<'a, Path>> for &'b std::path::Path
impl<'a, 'b> PartialEq<Cow<'a, Path>> for OsStr
impl<'a, 'b> PartialEq<Cow<'a, Path>> for OsString
impl<'a, 'b> PartialEq<Cow<'a, Path>> for std::path::Path
impl<'a, 'b> PartialEq<Cow<'a, Path>> for PathBuf
impl<'a, 'b> PartialEq<Cow<'b, OsStr>> for &'a std::path::Path
impl<'a, 'b> PartialEq<str> for Cow<'a, str>
impl<'a, 'b> PartialEq<str> for String
impl<'a, 'b> PartialEq<String> for &'a str
impl<'a, 'b> PartialEq<String> for Cow<'a, str>
impl<'a, 'b> PartialEq<String> for str
impl<'a, 'b> PartialEq<OsStr> for &'a std::path::Path
impl<'a, 'b> PartialEq<OsStr> for Cow<'a, OsStr>
impl<'a, 'b> PartialEq<OsStr> for Cow<'a, Path>
impl<'a, 'b> PartialEq<OsStr> for OsString
impl<'a, 'b> PartialEq<OsStr> for std::path::Path
impl<'a, 'b> PartialEq<OsStr> for PathBuf
impl<'a, 'b> PartialEq<OsString> for &'a OsStr
impl<'a, 'b> PartialEq<OsString> for &'a std::path::Path
impl<'a, 'b> PartialEq<OsString> for Cow<'a, OsStr>
impl<'a, 'b> PartialEq<OsString> for Cow<'a, Path>
impl<'a, 'b> PartialEq<OsString> for OsStr
impl<'a, 'b> PartialEq<OsString> for std::path::Path
impl<'a, 'b> PartialEq<OsString> for PathBuf
impl<'a, 'b> PartialEq<Path> for &'a OsStr
impl<'a, 'b> PartialEq<Path> for Cow<'a, OsStr>
impl<'a, 'b> PartialEq<Path> for Cow<'a, Path>
impl<'a, 'b> PartialEq<Path> for OsStr
impl<'a, 'b> PartialEq<Path> for OsString
impl<'a, 'b> PartialEq<Path> for PathBuf
impl<'a, 'b> PartialEq<PathBuf> for &'a OsStr
impl<'a, 'b> PartialEq<PathBuf> for &'a std::path::Path
impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, OsStr>
impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, Path>
impl<'a, 'b> PartialEq<PathBuf> for OsStr
impl<'a, 'b> PartialEq<PathBuf> for OsString
impl<'a, 'b> PartialEq<PathBuf> for std::path::Path
impl<'a, 'b, B, C> PartialEq<Cow<'b, C>> for Cow<'a, B>where
B: PartialEq<C> + ToOwned + ?Sized,
C: ToOwned + ?Sized,
impl<'a, T> PartialEq<&'a T> for Byteswhere
Bytes: PartialEq<T>,
T: ?Sized,
impl<'a, T> PartialEq<&'a T> for BytesMutwhere
BytesMut: PartialEq<T>,
T: ?Sized,
impl<'a, T> PartialEq<CompactRef<'a, T>> for CompactRef<'a, T>where
T: PartialEq<T>,
impl<'a, T, O> PartialEq<IterOnes<'a, T, O>> for IterOnes<'a, T, O>where
T: PartialEq<T> + 'a + BitStore,
O: PartialEq<O> + BitOrder,
impl<'a, T, O> PartialEq<IterZeros<'a, T, O>> for IterZeros<'a, T, O>where
T: PartialEq<T> + 'a + BitStore,
O: PartialEq<O> + BitOrder,
impl<'a, T: PartialEq> PartialEq<Symbol<'a, T>> for Symbol<'a, T>
impl<A, B> PartialEq<&B> for &Awhere
A: PartialEq<B> + ?Sized,
B: ?Sized,
impl<A, B> PartialEq<&B> for &mut Awhere
A: PartialEq<B> + ?Sized,
B: ?Sized,
impl<A, B> PartialEq<&mut B> for &Awhere
A: PartialEq<B> + ?Sized,
B: ?Sized,
impl<A, B> PartialEq<&mut B> for &mut Awhere
A: PartialEq<B> + ?Sized,
B: ?Sized,
impl<A, B> PartialEq<[B]> for [A]where
A: PartialEq<B>,
impl<A, B, const N: usize> PartialEq<&[B]> for [A; N]where
A: PartialEq<B>,
impl<A, B, const N: usize> PartialEq<&mut [B]> for [A; N]where
A: PartialEq<B>,
impl<A, B, const N: usize> PartialEq<[A; N]> for &[B]where
B: PartialEq<A>,
impl<A, B, const N: usize> PartialEq<[A; N]> for &mut [B]where
B: PartialEq<A>,
impl<A, B, const N: usize> PartialEq<[A; N]> for [B]where
B: PartialEq<A>,
impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]where
A: PartialEq<B>,
impl<A, B, const N: usize> PartialEq<[B]> for [A; N]where
A: PartialEq<B>,
impl<A, O, Rhs> PartialEq<Rhs> for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
BitSlice<<A as BitView>::Store, O>: PartialEq<Rhs>,
Rhs: ?Sized,
impl<B, C> PartialEq<ControlFlow<B, C>> for ControlFlow<B, C>where
B: PartialEq<B>,
C: PartialEq<C>,
impl<Dyn> PartialEq<DynMetadata<Dyn>> for DynMetadata<Dyn>where
Dyn: ?Sized,
impl<H> PartialEq<BuildHasherDefault<H>> for BuildHasherDefault<H>
impl<Idx> PartialEq<Range<Idx>> for Range<Idx>where
Idx: PartialEq<Idx>,
impl<Idx> PartialEq<RangeFrom<Idx>> for RangeFrom<Idx>where
Idx: PartialEq<Idx>,
impl<Idx> PartialEq<RangeInclusive<Idx>> for RangeInclusive<Idx>where
Idx: PartialEq<Idx>,
impl<Idx> PartialEq<RangeTo<Idx>> for RangeTo<Idx>where
Idx: PartialEq<Idx>,
impl<Idx> PartialEq<RangeToInclusive<Idx>> for RangeToInclusive<Idx>where
Idx: PartialEq<Idx>,
impl<Inner> PartialEq<Frozen<Inner>> for Frozen<Inner>where
Inner: PartialEq<Inner> + Mutability,
impl<K, V, A> PartialEq<BTreeMap<K, V, A>> for BTreeMap<K, V, A>where
K: PartialEq<K>,
V: PartialEq<V>,
A: Allocator + Clone,
impl<K, V, S> PartialEq<HashMap<K, V, S>> for HashMap<K, V, S>where
K: Eq + Hash,
V: PartialEq<V>,
S: BuildHasher,
impl<M1, M2, O1, O2, T1, T2> PartialEq<BitRef<'_, M2, T2, O2>> for BitRef<'_, M1, T1, O1>where
M1: Mutability,
M2: Mutability,
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<M1, M2, O, T1, T2> PartialEq<BitPtrRange<M2, T2, O>> for BitPtrRange<M1, T1, O>where
M1: Mutability,
M2: Mutability,
O: BitOrder,
T1: BitStore,
T2: BitStore,
impl<M1, M2, T1, T2> PartialEq<Address<M2, T2>> for Address<M1, T1>where
M1: Mutability,
M2: Mutability,
impl<M1, M2, T1, T2, O> PartialEq<BitPtr<M2, T2, O>> for BitPtr<M1, T1, O>where
M1: Mutability,
M2: Mutability,
T1: BitStore,
T2: BitStore,
O: BitOrder,
impl<M, T, O> PartialEq<&bool> for BitRef<'_, M, T, O>where
M: Mutability,
T: BitStore,
O: BitOrder,
impl<M, T, O> PartialEq<bool> for BitRef<'_, M, T, O>where
M: Mutability,
T: BitStore,
O: BitOrder,
impl<M, T, O> PartialEq<BitRef<'_, M, T, O>> for &boolwhere
M: Mutability,
T: BitStore,
O: BitOrder,
impl<M, T, O> PartialEq<BitRef<'_, M, T, O>> for boolwhere
M: Mutability,
T: BitStore,
O: BitOrder,
impl<O1, A, O2, T> PartialEq<BitArray<A, O2>> for BitSlice<T, O1>where
O1: BitOrder,
O2: BitOrder,
A: BitViewSized,
T: BitStore,
impl<O1, O2, T1, T2> PartialEq<BitBox<T2, O2>> for &BitSlice<T1, O1>where
O1: BitOrder,
O2: BitOrder,
T1: BitStore,
T2: BitStore,
impl<O1, O2, T1, T2> PartialEq<BitBox<T2, O2>> for &mut BitSlice<T1, O1>where
O1: BitOrder,
O2: BitOrder,
T1: BitStore,
T2: BitStore,
impl<O1, O2, T1, T2> PartialEq<BitBox<T2, O2>> for BitSlice<T1, O1>where
O1: BitOrder,
O2: BitOrder,
T1: BitStore,
T2: BitStore,
impl<P, Q> PartialEq<Pin<Q>> for Pin<P>where
P: Deref,
Q: Deref,
<P as Deref>::Target: PartialEq<<Q as Deref>::Target>,
impl<R> PartialEq<BitEnd<R>> for BitEnd<R>where
R: PartialEq<R> + BitRegister,
impl<R> PartialEq<BitIdx<R>> for BitIdx<R>where
R: PartialEq<R> + BitRegister,
impl<R> PartialEq<BitIdxError<R>> for BitIdxError<R>where
R: PartialEq<R> + BitRegister,
impl<R> PartialEq<BitMask<R>> for BitMask<R>where
R: PartialEq<R> + BitRegister,
impl<R> PartialEq<BitPos<R>> for BitPos<R>where
R: PartialEq<R> + BitRegister,
impl<R> PartialEq<BitSel<R>> for BitSel<R>where
R: PartialEq<R> + BitRegister,
impl<Ret, T> PartialEq<fn(_: T) -> Ret> for fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<extern "C" fn(_: T) -> Ret> for extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<extern "C" fn(_: T, ...) -> Ret> for extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<extern "C-unwind" fn(_: T) -> Ret> for extern "C-unwind" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<extern "C-unwind" fn(_: T, ...) -> Ret> for extern "C-unwind" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<unsafe fn(_: T) -> Ret> for unsafe fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<unsafe extern "C" fn(_: T) -> Ret> for unsafe extern "C" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<unsafe extern "C" fn(_: T, ...) -> Ret> for unsafe extern "C" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<unsafe extern "C-unwind" fn(_: T) -> Ret> for unsafe extern "C-unwind" fn (T₁, T₂, …, Tₙ) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<Ret, T> PartialEq<unsafe extern "C-unwind" fn(_: T, ...) -> Ret> for unsafe extern "C-unwind" fn (T₁, T₂, …, Tₙ, ...) -> Ret
This trait is implemented for function pointers with up to twelve arguments.
impl<T1, T2, O1, O2> PartialEq<&BitSlice<T2, O2>> for BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<&mut BitSlice<T2, O2>> for BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<BitSlice<T2, O2>> for &BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<BitSlice<T2, O2>> for &mut BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<BitSlice<T2, O2>> for BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
Tests if two BitSlice
s are semantically — not representationally — equal.
It is valid to compare slices of different ordering or memory types.
The equality condition requires that they have the same length and that at each index, the two slices have the same bit value.
impl<T1, T2, O1, O2> PartialEq<BitVec<T2, O2>> for &BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<BitVec<T2, O2>> for &mut BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T1, T2, O1, O2> PartialEq<BitVec<T2, O2>> for BitSlice<T1, O1>where
T1: BitStore,
T2: BitStore,
O1: BitOrder,
O2: BitOrder,
impl<T> PartialEq<BitPtrError<T>> for BitPtrError<T>where
T: PartialEq<T> + BitStore,
impl<T> PartialEq<BitSpanError<T>> for BitSpanError<T>where
T: PartialEq<T> + BitStore,
impl<T> PartialEq<Bound<T>> for Bound<T>where
T: PartialEq<T>,
impl<T> PartialEq<Option<T>> for Option<T>where
T: PartialEq<T>,
impl<T> PartialEq<Poll<T>> for Poll<T>where
T: PartialEq<T>,
impl<T> PartialEq<TrySendError<T>> for TrySendError<T>where
T: PartialEq<T>,
impl<T> PartialEq<*const T> for *const Twhere
T: ?Sized,
impl<T> PartialEq<*mut T> for *mut Twhere
T: ?Sized,
impl<T> PartialEq<(T,)> for (T₁, T₂, …, Tₙ)where
T: PartialEq<T> + ?Sized,
This trait is implemented for tuples up to twelve items long.