pub trait StructuralPartialEq { }
🔬This is a nightly-only experimental API. (structural_match #31434)
Expand description

Required trait for constants used in pattern matches.

Any type that derives PartialEq automatically implements this trait, regardless of whether its type-parameters implement Eq.

If a const item contains some type that does not implement this trait, then that type either (1.) does not implement PartialEq (which means the constant will not provide that comparison method, which code generation assumes is available), or (2.) it implements its own version of PartialEq (which we assume does not conform to a structural-equality comparison).

In either of the two scenarios above, we reject usage of such a constant in a pattern match.

See also the structural match RFC, and issue 63438 which motivated migrating from attribute-based design to this trait.

Implementors§

source§

impl StructuralPartialEq for AsciiChar

source§

impl StructuralPartialEq for CharErrorKind

1.0.0 · source§

impl StructuralPartialEq for core::cmp::Ordering

source§

impl StructuralPartialEq for Which

source§

impl StructuralPartialEq for FromBytesWithNulErrorKind

1.28.0 · source§

impl StructuralPartialEq for core::fmt::Alignment

source§

impl StructuralPartialEq for core::fmt::rt::Alignment

1.7.0 · source§

impl StructuralPartialEq for IpAddr

source§

impl StructuralPartialEq for Ipv6MulticastScope

source§

impl StructuralPartialEq for AddrKind

1.0.0 · source§

impl StructuralPartialEq for SocketAddr

source§

impl StructuralPartialEq for FloatErrorKind

1.0.0 · source§

impl StructuralPartialEq for FpCategory

1.55.0 · source§

impl StructuralPartialEq for IntErrorKind

source§

impl StructuralPartialEq for FullDecoded

source§

impl StructuralPartialEq for Sign

source§

impl StructuralPartialEq for AlignmentEnum16

source§

impl StructuralPartialEq for AlignmentEnum32

source§

impl StructuralPartialEq for AlignmentEnum64

source§

impl StructuralPartialEq for SearchStep

1.0.0 · source§

impl StructuralPartialEq for core::sync::atomic::Ordering

source§

impl StructuralPartialEq for TryFromFloatSecsErrorKind

source§

impl StructuralPartialEq for bool

source§

impl StructuralPartialEq for char

source§

impl StructuralPartialEq for i8

source§

impl StructuralPartialEq for i16

source§

impl StructuralPartialEq for i32

source§

impl StructuralPartialEq for i64

source§

impl StructuralPartialEq for i128

source§

impl StructuralPartialEq for isize

source§

impl StructuralPartialEq for str

source§

impl StructuralPartialEq for u8

source§

impl StructuralPartialEq for u16

source§

impl StructuralPartialEq for u32

source§

impl StructuralPartialEq for u64

source§

impl StructuralPartialEq for u128

source§

impl StructuralPartialEq for ()

source§

impl StructuralPartialEq for usize

1.28.0 · source§

impl StructuralPartialEq for Layout

1.50.0 · source§

impl StructuralPartialEq for LayoutError

source§

impl StructuralPartialEq for AllocError

1.34.0 · source§

impl StructuralPartialEq for CharTryFromError

1.20.0 · source§

impl StructuralPartialEq for ParseCharError

1.9.0 · source§

impl StructuralPartialEq for DecodeUtf16Error

1.59.0 · source§

impl StructuralPartialEq for TryFromCharError

source§

impl StructuralPartialEq for f32x2

source§

impl StructuralPartialEq for f32x4

source§

impl StructuralPartialEq for f32x8

source§

impl StructuralPartialEq for f32x16

source§

impl StructuralPartialEq for f64x1

source§

impl StructuralPartialEq for f64x2

source§

impl StructuralPartialEq for f64x4

source§

impl StructuralPartialEq for f64x8

source§

impl StructuralPartialEq for i8x2

source§

impl StructuralPartialEq for i8x4

source§

impl StructuralPartialEq for i8x8

source§

impl StructuralPartialEq for i8x16

source§

impl StructuralPartialEq for i8x32

source§

impl StructuralPartialEq for i8x64

source§

impl StructuralPartialEq for i16x2

source§

impl StructuralPartialEq for i16x4

source§

impl StructuralPartialEq for i16x8

source§

impl StructuralPartialEq for i16x16

source§

impl StructuralPartialEq for i16x32

source§

impl StructuralPartialEq for i32x2

source§

impl StructuralPartialEq for i32x4

source§

impl StructuralPartialEq for i32x8

source§

impl StructuralPartialEq for i32x16

source§

impl StructuralPartialEq for i64x1

source§

impl StructuralPartialEq for i64x2

source§

impl StructuralPartialEq for i64x4

source§

impl StructuralPartialEq for i64x8

source§

impl StructuralPartialEq for m8x16

source§

impl StructuralPartialEq for m16x8

source§

impl StructuralPartialEq for m32x4

source§

impl StructuralPartialEq for m64x2

source§

impl StructuralPartialEq for u8x2

source§

impl StructuralPartialEq for u8x4

source§

impl StructuralPartialEq for u8x8

source§

impl StructuralPartialEq for u8x16

source§

impl StructuralPartialEq for u8x32

source§

impl StructuralPartialEq for u8x64

source§

impl StructuralPartialEq for u16x2

source§

impl StructuralPartialEq for u16x4

source§

impl StructuralPartialEq for u16x8

source§

impl StructuralPartialEq for u16x16

source§

impl StructuralPartialEq for u16x32

source§

impl StructuralPartialEq for u32x2

source§

impl StructuralPartialEq for u32x4

source§

impl StructuralPartialEq for u32x8

source§

impl StructuralPartialEq for u32x16

source§

impl StructuralPartialEq for u64x1

source§

impl StructuralPartialEq for u64x2

source§

impl StructuralPartialEq for u64x4

source§

impl StructuralPartialEq for u64x8

1.27.0 · source§

impl StructuralPartialEq for CpuidResult

Available on x86 or x86-64 only.
1.69.0 · source§

impl StructuralPartialEq for FromBytesUntilNulError

1.64.0 · source§

impl StructuralPartialEq for FromBytesWithNulError

source§

impl StructuralPartialEq for Binary

source§

impl StructuralPartialEq for LowerHex

source§

impl StructuralPartialEq for Octal

source§

impl StructuralPartialEq for UpperHex

1.0.0 · source§

impl StructuralPartialEq for Error

source§

impl StructuralPartialEq for Assume

1.0.0 · source§

impl StructuralPartialEq for Ipv4Addr

1.0.0 · source§

impl StructuralPartialEq for Ipv6Addr

1.0.0 · source§

impl StructuralPartialEq for AddrParseError

1.0.0 · source§

impl StructuralPartialEq for SocketAddrV4

1.0.0 · source§

impl StructuralPartialEq for SocketAddrV6

source§

impl StructuralPartialEq for BiasedFp

source§

impl StructuralPartialEq for Number

1.0.0 · source§

impl StructuralPartialEq for ParseIntError

1.34.0 · source§

impl StructuralPartialEq for TryFromIntError

source§

impl StructuralPartialEq for Decoded

1.34.0 · source§

impl StructuralPartialEq for NonZeroI8

1.34.0 · source§

impl StructuralPartialEq for NonZeroI16

1.34.0 · source§

impl StructuralPartialEq for NonZeroI32

1.34.0 · source§

impl StructuralPartialEq for NonZeroI64

1.34.0 · source§

impl StructuralPartialEq for NonZeroI128

1.34.0 · source§

impl StructuralPartialEq for NonZeroIsize

1.28.0 · source§

impl StructuralPartialEq for NonZeroU8

1.28.0 · source§

impl StructuralPartialEq for NonZeroU16

1.28.0 · source§

impl StructuralPartialEq for NonZeroU32

1.28.0 · source§

impl StructuralPartialEq for NonZeroU64

1.28.0 · source§

impl StructuralPartialEq for NonZeroU128

1.28.0 · source§

impl StructuralPartialEq for NonZeroUsize

1.0.0 · source§

impl StructuralPartialEq for ParseFloatError

source§

impl StructuralPartialEq for IndexRange

1.0.0 · source§

impl StructuralPartialEq for RangeFull

source§

impl StructuralPartialEq for core::ptr::alignment::Alignment

1.0.0 · source§

impl StructuralPartialEq for ParseBoolError

1.0.0 · source§

impl StructuralPartialEq for Utf8Error

1.36.0 · source§

impl StructuralPartialEq for RawWaker

1.36.0 · source§

impl StructuralPartialEq for RawWakerVTable

1.3.0 · source§

impl StructuralPartialEq for Duration

source§

impl StructuralPartialEq for Nanoseconds

1.66.0 · source§

impl StructuralPartialEq for TryFromFloatSecsError

1.33.0 · source§

impl StructuralPartialEq for PhantomPinned

source§

impl<'a> StructuralPartialEq for Part<'a>

1.10.0 · source§

impl<'a> StructuralPartialEq for Location<'a>

source§

impl<'a> StructuralPartialEq for Utf8Chunk<'a>

source§

impl<A, Z, Y, X, W, V, U, T> StructuralPartialEq for (A, Z, Y, X, W, V, U, T)

source§

impl<B, A, Z, Y, X, W, V, U, T> StructuralPartialEq for (B, A, Z, Y, X, W, V, U, T)

1.55.0 · source§

impl<B, C> StructuralPartialEq for ControlFlow<B, C>

source§

impl<C, B, A, Z, Y, X, W, V, U, T> StructuralPartialEq for (C, B, A, Z, Y, X, W, V, U, T)

source§

impl<D, C, B, A, Z, Y, X, W, V, U, T> StructuralPartialEq for (D, C, B, A, Z, Y, X, W, V, U, T)

source§

impl<E, D, C, B, A, Z, Y, X, W, V, U, T> StructuralPartialEq for (E, D, C, B, A, Z, Y, X, W, V, U, T)

1.0.0 · source§

impl<Idx> StructuralPartialEq for Range<Idx>

1.0.0 · source§

impl<Idx> StructuralPartialEq for RangeFrom<Idx>

1.26.0 · source§

impl<Idx> StructuralPartialEq for RangeInclusive<Idx>

1.0.0 · source§

impl<Idx> StructuralPartialEq for RangeTo<Idx>

1.26.0 · source§

impl<Idx> StructuralPartialEq for RangeToInclusive<Idx>

1.17.0 · source§

impl<T> StructuralPartialEq for Bound<T>

1.0.0 · source§

impl<T> StructuralPartialEq for Option<T>

1.36.0 · source§

impl<T> StructuralPartialEq for Poll<T>

source§

impl<T> StructuralPartialEq for [T]

source§

impl<T> StructuralPartialEq for (T₁, T₂, …, Tₙ)

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

1.19.0 · source§

impl<T> StructuralPartialEq for Reverse<T>

source§

impl<T> StructuralPartialEq for Saturating<T>

1.0.0 · source§

impl<T> StructuralPartialEq for Wrapping<T>

1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

source§

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

source§

impl<T: ?Sized> StructuralPartialEq for &T

1.20.0 · source§

impl<T: ?Sized> StructuralPartialEq for ManuallyDrop<T>

source§

impl<T: ?Sized> StructuralPartialEq for PhantomData<T>

source§

impl<U, T> StructuralPartialEq for (U, T)

source§

impl<V, U, T> StructuralPartialEq for (V, U, T)

source§

impl<W, V, U, T> StructuralPartialEq for (W, V, U, T)

source§

impl<X, W, V, U, T> StructuralPartialEq for (X, W, V, U, T)

source§

impl<Y, R> StructuralPartialEq for GeneratorState<Y, R>

source§

impl<Y, X, W, V, U, T> StructuralPartialEq for (Y, X, W, V, U, T)

source§

impl<Z, Y, X, W, V, U, T> StructuralPartialEq for (Z, Y, X, W, V, U, T)