Skip to main content

StructuralPartialEq

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.

Constants are only allowed as patterns if (a) their type implements PartialEq, and (b) interpreting the value of the constant as a pattern is equivalent to calling PartialEq. This ensures that constants used as patterns cannot expose implementation details in an unexpected way or cause semver hazards.

This trait ensures point (b). Any type that derives PartialEq automatically implements this trait.

Implementing this trait (which is unstable) is a way for type authors to explicitly allow comparing const values of this type; that operation will recursively compare all fields (including private fields), even if that behavior differs from PartialEq. This can make it semver-breaking to add further private fields to a type.

Dyn Compatibilityยง

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementorsยง

Sourceยง

impl StructuralPartialEq for ()

1.26.0 ยท Sourceยง

impl StructuralPartialEq for AccessError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for AddrParseError

Sourceยง

impl StructuralPartialEq for std::mem::Alignment

1.28.0 ยท Sourceยง

impl StructuralPartialEq for std::fmt::Alignment

Sourceยง

impl StructuralPartialEq for AllocError

Sourceยง

impl StructuralPartialEq for AsciiChar

Sourceยง

impl StructuralPartialEq for Assume

Sourceยง

impl StructuralPartialEq for AtomicOrdering

1.65.0 ยท Sourceยง

impl StructuralPartialEq for BacktraceStatus

Sourceยง

impl StructuralPartialEq for BacktraceStyle

1.64.0 ยท Sourceยง

impl StructuralPartialEq for CStr

1.64.0 ยท Sourceยง

impl StructuralPartialEq for CString

Sourceยง

impl StructuralPartialEq for CharCase

1.34.0 ยท Sourceยง

impl StructuralPartialEq for CharTryFromError

1.27.0 ยท Sourceยง

impl StructuralPartialEq for CpuidResult

Sourceยง

impl StructuralPartialEq for DebugAsHex

1.9.0 ยท Sourceยง

impl StructuralPartialEq for DecodeUtf16Error

1.3.0 ยท Sourceยง

impl StructuralPartialEq for Duration

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Error

1.0.0 ยท Sourceยง

impl StructuralPartialEq for ErrorKind

1.61.0 ยท Sourceยง

impl StructuralPartialEq for ExitCode

1.0.0 ยท Sourceยง

impl StructuralPartialEq for ExitStatus

Sourceยง

impl StructuralPartialEq for ExitStatusError

Sourceยง

impl StructuralPartialEq for FieldId

1.1.0 ยท Sourceยง

impl StructuralPartialEq for FileType

Sourceยง

impl StructuralPartialEq for FormattingOptions

1.0.0 ยท Sourceยง

impl StructuralPartialEq for FpCategory

1.69.0 ยท Sourceยง

impl StructuralPartialEq for FromBytesUntilNulError

1.64.0 ยท Sourceยง

impl StructuralPartialEq for FromBytesWithNulError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for FromUtf8Error

1.64.0 ยท Sourceยง

impl StructuralPartialEq for FromVecWithNulError

1.86.0 ยท Sourceยง

impl StructuralPartialEq for GetDisjointMutError

1.8.0 ยท Sourceยง

impl StructuralPartialEq for Instant

1.55.0 ยท Sourceยง

impl StructuralPartialEq for IntErrorKind

1.64.0 ยท Sourceยง

impl StructuralPartialEq for IntoStringError

1.63.0 ยท Sourceยง

impl StructuralPartialEq for InvalidHandleError

Available on Windows only.
1.7.0 ยท Sourceยง

impl StructuralPartialEq for IpAddr

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Ipv4Addr

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Ipv6Addr

Sourceยง

impl StructuralPartialEq for Ipv6MulticastScope

1.28.0 ยท Sourceยง

impl StructuralPartialEq for Layout

1.50.0 ยท Sourceยง

impl StructuralPartialEq for LayoutError

Sourceยง

impl StructuralPartialEq for Locality

Sourceยง

impl StructuralPartialEq for NormalizeError

1.64.0 ยท Sourceยง

impl StructuralPartialEq for NulError

1.63.0 ยท Sourceยง

impl StructuralPartialEq for NullHandleError

Available on Windows only.
1.0.0 ยท Sourceยง

impl StructuralPartialEq for std::cmp::Ordering

1.0.0 ยท Sourceยง

impl StructuralPartialEq for std::sync::atomic::Ordering

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Output

1.0.0 ยท Sourceยง

impl StructuralPartialEq for ParseBoolError

1.20.0 ยท Sourceยง

impl StructuralPartialEq for ParseCharError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for ParseFloatError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for ParseIntError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Permissions

1.33.0 ยท Sourceยง

impl StructuralPartialEq for PhantomPinned

1.0.0 ยท Sourceยง

impl StructuralPartialEq for RangeFull

1.36.0 ยท Sourceยง

impl StructuralPartialEq for RawWaker

1.36.0 ยท Sourceยง

impl StructuralPartialEq for RawWakerVTable

1.0.0 ยท Sourceยง

impl StructuralPartialEq for RecvError

1.12.0 ยท Sourceยง

impl StructuralPartialEq for RecvTimeoutError

Sourceยง

impl StructuralPartialEq for SearchStep

1.0.0 ยท Sourceยง

impl StructuralPartialEq for SeekFrom

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Shutdown

Sourceยง

impl StructuralPartialEq for Sign

Sourceยง

impl StructuralPartialEq for SimdAlign

1.0.0 ยท Sourceยง

impl StructuralPartialEq for SocketAddr

1.0.0 ยท Sourceยง

impl StructuralPartialEq for SocketAddrV4

1.0.0 ยท Sourceยง

impl StructuralPartialEq for SocketAddrV6

1.0.0 ยท Sourceยง

impl StructuralPartialEq for String

1.7.0 ยท Sourceยง

impl StructuralPartialEq for StripPrefixError

1.8.0 ยท Sourceยง

impl StructuralPartialEq for SystemTime

1.19.0 ยท Sourceยง

impl StructuralPartialEq for ThreadId

1.59.0 ยท Sourceยง

impl StructuralPartialEq for TryFromCharError

1.66.0 ยท Sourceยง

impl StructuralPartialEq for TryFromFloatSecsError

1.34.0 ยท Sourceยง

impl StructuralPartialEq for TryFromIntError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for TryRecvError

1.57.0 ยท Sourceยง

impl StructuralPartialEq for TryReserveError

Sourceยง

impl StructuralPartialEq for TryReserveErrorKind

Sourceยง

impl StructuralPartialEq for UCred

Available on Unix only.
Sourceยง

impl StructuralPartialEq for UnorderedKeyError

1.0.0 ยท Sourceยง

impl StructuralPartialEq for Utf8Error

1.0.0 ยท Sourceยง

impl StructuralPartialEq for VarError

Sourceยง

impl StructuralPartialEq for VariantId

1.5.0 ยท Sourceยง

impl StructuralPartialEq for WaitTimeoutResult

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 usize

1.0.0 ยท Sourceยง

impl<'a> StructuralPartialEq for Component<'a>

Sourceยง

impl<'a> StructuralPartialEq for PhantomContravariantLifetime<'a>

Sourceยง

impl<'a> StructuralPartialEq for PhantomCovariantLifetime<'a>

Sourceยง

impl<'a> StructuralPartialEq for PhantomInvariantLifetime<'a>

1.0.0 ยท Sourceยง

impl<'a> StructuralPartialEq for Prefix<'a>

1.79.0 ยท Sourceยง

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

Sourceยง

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

1.55.0 ยท Sourceยง

impl<B, C> StructuralPartialEq for ControlFlow<B, C>
where B: PartialEq, C: PartialEq,

1.0.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::ops::Range<Idx>
where Idx: PartialEq,

1.96.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::range::Range<Idx>
where Idx: PartialEq,

1.0.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::ops::RangeFrom<Idx>
where Idx: PartialEq,

1.96.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::range::RangeFrom<Idx>
where Idx: PartialEq,

1.26.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::ops::RangeInclusive<Idx>
where Idx: PartialEq,

1.95.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::range::RangeInclusive<Idx>
where Idx: PartialEq,

1.0.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for RangeTo<Idx>
where Idx: PartialEq,

1.26.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::ops::RangeToInclusive<Idx>
where Idx: PartialEq,

1.96.0 ยท Sourceยง

impl<Idx> StructuralPartialEq for std::range::RangeToInclusive<Idx>
where Idx: PartialEq,

1.0.0 ยท Sourceยง

impl<T, E> StructuralPartialEq for Result<T, E>
where T: PartialEq, E: PartialEq,

Sourceยง

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

1.0.0 ยท Sourceยง

impl<T: PartialEq> StructuralPartialEq for SendError<T>

Sourceยง

impl<T: PartialEq> StructuralPartialEq for SendTimeoutError<T>

1.0.0 ยท Sourceยง

impl<T: PartialEq> StructuralPartialEq for TrySendError<T>

Sourceยง

impl<T> StructuralPartialEq for &T
where T: ?Sized,

Sourceยง

impl<T> StructuralPartialEq for (Tโ‚, Tโ‚‚, โ€ฆ, Tโ‚™)

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

1.17.0 ยท Sourceยง

impl<T> StructuralPartialEq for Bound<T>
where T: PartialEq,

Sourceยง

impl<T> StructuralPartialEq for Complex<T>
where T: PartialEq,

1.0.0 ยท Sourceยง

impl<T> StructuralPartialEq for Cursor<T>
where T: PartialEq,

1.20.0 ยท Sourceยง

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

Sourceยง

impl<T> StructuralPartialEq for MaybeDangling<T>
where T: ?Sized,

Sourceยง

impl<T> StructuralPartialEq for NonZero<T>

1.0.0 ยท Sourceยง

impl<T> StructuralPartialEq for Option<T>

Sourceยง

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

1.36.0 ยท Sourceยง

impl<T> StructuralPartialEq for Poll<T>
where T: PartialEq,

1.19.0 ยท Sourceยง

impl<T> StructuralPartialEq for Reverse<T>
where T: PartialEq,

1.74.0 ยท Sourceยง

impl<T> StructuralPartialEq for Saturating<T>
where T: PartialEq,

Sourceยง

impl<T> StructuralPartialEq for SyncView<T>

Sourceยง

impl<T> StructuralPartialEq for TraitImpl<T>
where T: PartialEq + ?Sized,

1.0.0 ยท Sourceยง

impl<T> StructuralPartialEq for Wrapping<T>
where T: PartialEq,

Sourceยง

impl<T> StructuralPartialEq for [T]

Sourceยง

impl<Y, R> StructuralPartialEq for CoroutineState<Y, R>
where Y: PartialEq, R: PartialEq,