core::marker

Trait StructuralPartialEq

Source
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 PartialEq.

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 an attribute-based design to this trait.

Implementors§

Source§

impl StructuralPartialEq for AsciiChar

1.0.0 · Source§

impl StructuralPartialEq for core::cmp::Ordering

1.28.0 · Source§

impl StructuralPartialEq for core::fmt::Alignment

1.7.0 · Source§

impl StructuralPartialEq for IpAddr

Source§

impl StructuralPartialEq for Ipv6MulticastScope

1.0.0 · Source§

impl StructuralPartialEq for SocketAddr

1.0.0 · Source§

impl StructuralPartialEq for FpCategory

1.55.0 · Source§

impl StructuralPartialEq for IntErrorKind

Source§

impl StructuralPartialEq for SearchStep

1.0.0 · Source§

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

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

Source§

impl StructuralPartialEq for AllocError

1.28.0 · Source§

impl StructuralPartialEq for Layout

1.50.0 · Source§

impl StructuralPartialEq for LayoutError

1.27.0 · Source§

impl StructuralPartialEq for CpuidResult

Available on x86 or x86-64 only.
1.34.0 · Source§

impl StructuralPartialEq for CharTryFromError

1.9.0 · Source§

impl StructuralPartialEq for DecodeUtf16Error

1.20.0 · Source§

impl StructuralPartialEq for ParseCharError

1.59.0 · Source§

impl StructuralPartialEq for TryFromCharError

1.69.0 · Source§

impl StructuralPartialEq for FromBytesUntilNulError

1.64.0 · Source§

impl StructuralPartialEq for FromBytesWithNulError

1.64.0 · Source§

impl StructuralPartialEq for CStr

1.0.0 · Source§

impl StructuralPartialEq for Error

Source§

impl StructuralPartialEq for Assume

1.0.0 · Source§

impl StructuralPartialEq for AddrParseError

1.0.0 · Source§

impl StructuralPartialEq for Ipv4Addr

1.0.0 · Source§

impl StructuralPartialEq for Ipv6Addr

1.0.0 · Source§

impl StructuralPartialEq for SocketAddrV4

1.0.0 · Source§

impl StructuralPartialEq for SocketAddrV6

1.0.0 · Source§

impl StructuralPartialEq for ParseFloatError

1.0.0 · Source§

impl StructuralPartialEq for ParseIntError

1.34.0 · Source§

impl StructuralPartialEq for TryFromIntError

1.0.0 · Source§

impl StructuralPartialEq for RangeFull

Source§

impl StructuralPartialEq for core::ptr::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

1.66.0 · Source§

impl StructuralPartialEq for TryFromFloatSecsError

1.33.0 · Source§

impl StructuralPartialEq for PhantomPinned

Source§

impl<'a> StructuralPartialEq for Utf8Pattern<'a>

1.10.0 · Source§

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

1.79.0 · Source§

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

1.55.0 · Source§

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

1.0.0 · Source§

impl<Idx> StructuralPartialEq for core::ops::Range<Idx>

1.0.0 · Source§

impl<Idx> StructuralPartialEq for core::ops::RangeFrom<Idx>

1.26.0 · Source§

impl<Idx> StructuralPartialEq for core::ops::RangeInclusive<Idx>

1.0.0 · Source§

impl<Idx> StructuralPartialEq for RangeTo<Idx>

1.26.0 · Source§

impl<Idx> StructuralPartialEq for RangeToInclusive<Idx>

Source§

impl<Idx> StructuralPartialEq for core::range::Range<Idx>

Source§

impl<Idx> StructuralPartialEq for core::range::RangeFrom<Idx>

Source§

impl<Idx> StructuralPartialEq for core::range::RangeInclusive<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 NonZero<T>

1.74.0 · 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<Y, R> StructuralPartialEq for CoroutineState<Y, R>