Trait frame_support::dispatch::marker::StructuralEq [−][src]
pub trait StructuralEq { }
structural_match
)Expand description
Required trait for constants used in pattern matches.
Any type that derives Eq
automatically implements this trait, regardless
of whether its type parameters implement Eq
.
This is a hack to work around a limitation in our type system.
Background
We want to require that types of consts used in pattern matches
have the attribute #[derive(PartialEq, Eq)]
.
In a more ideal world, we could check that requirement by just checking that
the given type implements both the StructuralPartialEq
trait and
the Eq
trait. However, you can have ADTs that do derive(PartialEq, Eq)
,
and be a case that we want the compiler to accept, and yet the constant’s
type fails to implement Eq
.
Namely, a case like this:
#[derive(PartialEq, Eq)] struct Wrap<X>(X); fn higher_order(_: &()) { } const CFN: Wrap<fn(&())> = Wrap(higher_order); fn main() { match CFN { CFN => {} _ => {} } }
(The problem in the above code is that Wrap<fn(&())>
does not implement
PartialEq
, nor Eq
, because for<'a> fn(&'a _)
does not implement those
traits.)
Therefore, we cannot rely on naive check for StructuralPartialEq
and
mere Eq
.
As a hack to work around this, we use two separate traits injected by each
of the two derives (#[derive(PartialEq)]
and #[derive(Eq)]
) and check
that both of them are present as part of structural-match checking.
Implementations on Foreign Types
impl StructuralEq for OptionBool
impl<T> StructuralEq for Compact<T>
impl StructuralEq for Error
impl StructuralEq for Error
impl<'t> StructuralEq for Match<'t>
impl<'t> StructuralEq for Match<'t>
impl StructuralEq for Match
impl StructuralEq for MatchKind
impl StructuralEq for MatchKind
impl StructuralEq for ClassBytesRange
impl StructuralEq for WithComments
impl StructuralEq for ClassPerl
impl StructuralEq for LiteralKind
impl StructuralEq for Utf8Sequence
impl StructuralEq for ClassUnicodeRange
impl StructuralEq for ClassUnicodeKind
impl StructuralEq for Repetition
impl StructuralEq for Class
impl StructuralEq for ClassUnicode
impl StructuralEq for ClassUnicode
impl StructuralEq for ClassSetItem
impl StructuralEq for SetFlags
impl StructuralEq for Literal
impl StructuralEq for Ast
impl StructuralEq for Flag
impl StructuralEq for ErrorKind
impl StructuralEq for Assertion
impl StructuralEq for Comment
impl StructuralEq for RepetitionRange
impl StructuralEq for Error
impl StructuralEq for ClassSetRange
impl StructuralEq for Anchor
impl StructuralEq for ClassPerlKind
impl StructuralEq for Group
impl StructuralEq for Span
impl StructuralEq for HirKind
impl StructuralEq for ClassSetUnion
impl StructuralEq for Literal
impl StructuralEq for Position
impl StructuralEq for RepetitionOp
impl StructuralEq for ClassAsciiKind
impl StructuralEq for Hir
impl StructuralEq for ErrorKind
impl StructuralEq for Error
impl StructuralEq for CaptureName
impl StructuralEq for AssertionKind
impl StructuralEq for FlagsItemKind
impl StructuralEq for ClassUnicodeOpKind
impl StructuralEq for Utf8Range
impl StructuralEq for RepetitionKind
impl StructuralEq for Class
impl StructuralEq for SpecialLiteralKind
impl StructuralEq for RepetitionRange
impl StructuralEq for ClassBracketed
impl StructuralEq for ClassBytes
impl StructuralEq for GroupKind
impl StructuralEq for Flags
impl StructuralEq for Literal
impl StructuralEq for Group
impl StructuralEq for Error
impl StructuralEq for ClassAscii
impl StructuralEq for FlagsItem
impl StructuralEq for Literals
impl StructuralEq for WordBoundary
impl StructuralEq for Repetition
impl StructuralEq for HexLiteralKind
impl StructuralEq for ClassSetBinaryOpKind
impl StructuralEq for Concat
impl StructuralEq for ClassSet
impl StructuralEq for ClassSetBinaryOp
impl StructuralEq for Alternation
impl StructuralEq for RepetitionKind
impl StructuralEq for GroupKind
impl StructuralEq for WaitTimeoutResult
impl StructuralEq for OnceState
impl StructuralEq for UnparkToken
impl StructuralEq for RequeueOp
impl StructuralEq for ParkToken
impl StructuralEq for UnparkResult
impl StructuralEq for ParkResult
impl StructuralEq for FilterOp
impl StructuralEq for LittleEndian
impl StructuralEq for BigEndian
impl StructuralEq for ValueType
impl StructuralEq for Signature
impl StructuralEq for BrTableData
impl StructuralEq for Type
impl StructuralEq for BlockType
impl StructuralEq for FunctionType
impl StructuralEq for ValueType
impl StructuralEq for Instruction
impl StructuralEq for StartedWith
impl StructuralEq for Words
impl StructuralEq for Words
impl StructuralEq for Pages
impl StructuralEq for Pages
impl StructuralEq for Bytes
impl StructuralEq for Errno
impl StructuralEq for Error
impl StructuralEq for U256
impl StructuralEq for U128
impl StructuralEq for U512
impl StructuralEq for FromStrRadixErrKind
impl<U> StructuralEq for PInt<U> where
U: Unsigned + NonZero,
impl<U> StructuralEq for NInt<U> where
U: Unsigned + NonZero,
impl StructuralEq for Less
impl StructuralEq for Greater
impl StructuralEq for Z0
impl StructuralEq for UTerm
impl StructuralEq for ATerm
impl<U, B> StructuralEq for UInt<U, B>
impl StructuralEq for B1
impl StructuralEq for Equal
impl<V, A> StructuralEq for TArr<V, A>
impl StructuralEq for B0
impl StructuralEq for IsNormalized
impl StructuralEq for InvalidKeyLength
impl StructuralEq for MacError
impl StructuralEq for Signature
impl StructuralEq for Affine
impl StructuralEq for Message
impl StructuralEq for PublicKey
impl StructuralEq for SecretKey
impl StructuralEq for Scalar
impl StructuralEq for Error
impl StructuralEq for RecoveryId
impl StructuralEq for Jacobian
impl StructuralEq for AffineStorage
impl StructuralEq for MacError
impl StructuralEq for InvalidKeyLength
impl StructuralEq for u32x4
impl StructuralEq for Error
impl StructuralEq for PublicKey
impl StructuralEq for VRFProof
impl StructuralEq for RistrettoBoth
impl StructuralEq for ChainCode
impl StructuralEq for Commitment
impl StructuralEq for ECQVCertPublic
impl StructuralEq for VRFProofBatchable
impl StructuralEq for VRFOutput
impl StructuralEq for Signature
impl StructuralEq for VRFInOut
impl StructuralEq for Cosignature
impl<K> StructuralEq for ExtendedKey<K>
impl StructuralEq for MultiSignatureStage
impl StructuralEq for SignatureError
impl StructuralEq for PublicKey
impl StructuralEq for TryReserveError
impl<T> StructuralEq for AllowStdIo<T>
impl StructuralEq for Aborted
impl<T, E> StructuralEq for TryChunksError<T, E>
impl StructuralEq for PollNext
impl StructuralEq for Canceled
impl<T> StructuralEq for TrySendError<T>
impl StructuralEq for SendError
impl<D> StructuralEq for OwnedNode<D> where
D: Borrow<[u8]>,
impl<HO> StructuralEq for Record<HO>
impl<'a> StructuralEq for NodeHandle<'a>
impl<T, E> StructuralEq for TrieError<T, E>
impl StructuralEq for NibbleVec
impl<HO, CE> StructuralEq for Error<HO, CE>
impl StructuralEq for NibbleSlicePlan
impl StructuralEq for NodeHandlePlan
impl<'a> StructuralEq for Node<'a>
impl StructuralEq for NodePlan
impl<T> StructuralEq for MemCounter<T>
impl<T> StructuralEq for NoopTracker<T>
impl StructuralEq for DwMacro
impl StructuralEq for DwLnct
impl StructuralEq for Register
impl StructuralEq for DwId
impl StructuralEq for Augmentation
impl StructuralEq for ColumnType
impl StructuralEq for DwLle
impl StructuralEq for DwTag
impl StructuralEq for BaseAddresses
impl<R, Offset> StructuralEq for FrameDescriptionEntry<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl StructuralEq for DwUt
impl<T> StructuralEq for ArangeEntry<T> where
T: Copy,
impl<T> StructuralEq for DebugLineStrOffset<T>
impl StructuralEq for DwAt
impl<T> StructuralEq for DebugStrOffset<T>
impl<T> StructuralEq for DebugLocListsBase<T>
impl StructuralEq for DwCfa
impl StructuralEq for ReaderOffsetId
impl<Offset> StructuralEq for UnitType<Offset> where
Offset: ReaderOffset,
impl StructuralEq for Range
impl StructuralEq for DwVis
impl StructuralEq for DwCc
impl StructuralEq for DwoId
impl StructuralEq for Pointer
impl StructuralEq for DwLns
impl StructuralEq for DwAte
impl StructuralEq for BigEndian
impl<T> StructuralEq for DebugAbbrevOffset<T>
impl StructuralEq for DwDsc
impl<T> StructuralEq for DebugMacroOffset<T>
impl StructuralEq for FileEntryFormat
impl<R> StructuralEq for RegisterRule<R> where
R: Reader,
impl StructuralEq for DwarfFileType
impl<T> StructuralEq for DieReference<T>
impl StructuralEq for DwChildren
impl StructuralEq for DwAccess
impl StructuralEq for DwDs
impl<R> StructuralEq for CfaRule<R> where
R: Reader,
impl StructuralEq for DwLne
impl<T> StructuralEq for DebugStrOffsetsBase<T>
impl<R, Offset> StructuralEq for Operation<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<R> StructuralEq for DebugFrame<R> where
R: Reader,
impl<R> StructuralEq for LocationListEntry<R> where
R: Reader,
impl<T> StructuralEq for DebugAddrIndex<T>
impl<R, Offset> StructuralEq for CompleteLineProgram<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<R, Offset> StructuralEq for FileEntry<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<T> StructuralEq for UnitOffset<T>
impl StructuralEq for Abbreviation
impl StructuralEq for DwOp
impl<T> StructuralEq for DebugMacinfoOffset<T>
impl StructuralEq for SectionId
impl StructuralEq for Encoding
impl StructuralEq for RunTimeEndian
impl<R> StructuralEq for Expression<R> where
R: Reader,
impl<R> StructuralEq for Attribute<R> where
R: Reader,
impl<T> StructuralEq for RangeListsOffset<T>
impl StructuralEq for DwDefaulted
impl<'bases, Section, R> StructuralEq for PartialFrameDescriptionEntry<'bases, Section, R> where
R: Reader,
Section: UnwindSection<R>,
impl StructuralEq for DwEnd
impl StructuralEq for LittleEndian
impl StructuralEq for DwEhPe
impl StructuralEq for DwVirtuality
impl<T> StructuralEq for DebugLineOffset<T>
impl StructuralEq for DwInl
impl<R, Offset> StructuralEq for LineProgramHeader<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl StructuralEq for DwOrd
impl<T> StructuralEq for DebugStrOffsetsIndex<T>
impl StructuralEq for LineEncoding
impl<T> StructuralEq for DebugFrameOffset<T>
impl StructuralEq for LineRow
impl StructuralEq for Format
impl<T> StructuralEq for DebugTypesOffset<T>
impl StructuralEq for DwAddr
impl<T> StructuralEq for LocationListsOffset<T>
impl<R, Offset> StructuralEq for LineInstruction<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<T> StructuralEq for DebugInfoOffset<T>
impl StructuralEq for AttributeSpecification
impl<T> StructuralEq for DebugLocListsIndex<T>
impl<R> StructuralEq for CallFrameInstruction<R> where
R: Reader,
impl StructuralEq for SectionBaseAddresses
impl StructuralEq for DwIdx
impl<T> StructuralEq for DebugRngListsIndex<T>
impl<R> StructuralEq for UnwindContext<R> where
R: Reader,
impl StructuralEq for DwRle
impl StructuralEq for DebugTypeSignature
impl<T> StructuralEq for DebugRngListsBase<T>
impl<R> StructuralEq for EhFrame<R> where
R: Reader,
impl<T> StructuralEq for EhFrameOffset<T>
impl<R> StructuralEq for UnwindTableRow<R> where
R: Reader,
impl<T> StructuralEq for DebugAddrBase<T>
impl<R> StructuralEq for EhFrameHdr<R> where
R: Reader,
impl StructuralEq for DwLang
impl<R, Offset> StructuralEq for UnitHeader<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<R, Offset> StructuralEq for AttributeValue<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl StructuralEq for DwForm
impl<'bases, Section, R> StructuralEq for CieOrFde<'bases, Section, R> where
R: Reader,
Section: UnwindSection<R>,
impl StructuralEq for Error
impl<T> StructuralEq for UnitSectionOffset<T>
impl<R, Offset> StructuralEq for CommonInformationEntry<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<'input, Endian> StructuralEq for EndianSlice<'input, Endian> where
Endian: Endianity,
impl<R, Offset> StructuralEq for IncompleteLineProgram<R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl StructuralEq for ValueType
impl<Section> StructuralEq for SymbolFlags<Section>
impl StructuralEq for SymbolIndex
impl StructuralEq for Architecture
impl<E> StructuralEq for U32Bytes<E> where
E: Endian,
impl<'data> StructuralEq for CompressedData<'data>
impl<E> StructuralEq for I64Bytes<E> where
E: Endian,
impl StructuralEq for Endianness
impl StructuralEq for ComdatKind
impl<E> StructuralEq for U16Bytes<E> where
E: Endian,
impl StructuralEq for FileFlags
impl<'data> StructuralEq for SymbolMapName<'data>
impl<'data> StructuralEq for Bytes<'data>
impl StructuralEq for Error
impl<'data> StructuralEq for Export<'data>
impl StructuralEq for BigEndian
impl StructuralEq for SymbolScope
impl StructuralEq for RelocationEncoding
impl StructuralEq for RelocationKind
impl<E> StructuralEq for I16Bytes<E> where
E: Endian,
impl StructuralEq for SymbolSection
impl<E> StructuralEq for I32Bytes<E> where
E: Endian,
impl StructuralEq for RelocationTarget
impl StructuralEq for BinaryFormat
impl StructuralEq for AddressSize
impl StructuralEq for CompressionFormat
impl StructuralEq for SectionFlags
impl<'data> StructuralEq for Import<'data>
impl StructuralEq for ArchiveKind
impl StructuralEq for LittleEndian
impl StructuralEq for SectionIndex
impl StructuralEq for SectionKind
impl StructuralEq for SymbolKind
impl<'data> StructuralEq for ObjectMapEntry<'data>
impl<E> StructuralEq for U64Bytes<E> where
E: Endian,
impl StructuralEq for StreamResult
impl StructuralEq for TINFLStatus
impl StructuralEq for MZError
impl StructuralEq for TDEFLFlush
impl StructuralEq for DataFormat
impl StructuralEq for MZFlush
impl StructuralEq for CompressionStrategy
impl StructuralEq for TDEFLStatus
impl StructuralEq for CompressionLevel
impl StructuralEq for MZStatus
impl<Info> StructuralEq for DispatchErrorWithPostInfo<Info> where
Info: Eq + PartialEq<Info> + Clone + Copy + Encode + Decode + Printable,
impl<Header, Extrinsic> StructuralEq for Block<Header, Extrinsic> where
Extrinsic: MaybeSerialize,
impl<Number, Hash> StructuralEq for Header<Number, Hash> where
Hash: Hash,
Number: Copy + Into<U256> + TryFrom<U256>,
impl<Address, Call, Signature, Extra> StructuralEq for UncheckedExtrinsic<Address, Call, Signature, Extra> where
Extra: SignedExtension,
Implementors
impl<A: AssetId, B: Balance, OnDrop: HandleImbalanceDrop<A, B>, OppositeOnDrop: HandleImbalanceDrop<A, B>> StructuralEq for frame_support::traits::tokens::fungibles::Imbalance<A, B, OnDrop, OppositeOnDrop>
impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalanceDrop<B>> StructuralEq for frame_support::traits::tokens::fungible::Imbalance<B, OnDrop, OppositeOnDrop>