Trait sp_std::marker::StructuralEq[][src]

pub trait StructuralEq { }
🔬 This is a nightly-only experimental API. (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

Implementors

impl StructuralEq for Error

impl StructuralEq for FunctionMetadata

impl StructuralEq for FunctionArgumentMetadata

impl<E> StructuralEq for FnEncode<E> where
    E: Encode + 'static, 

impl StructuralEq for OuterEventMetadata

impl StructuralEq for EventMetadata

impl StructuralEq for StorageEntryMetadata

impl StructuralEq for ModuleConstantMetadata

impl StructuralEq for ErrorMetadata

impl StructuralEq for StorageHasher

impl StructuralEq for StorageEntryType

impl StructuralEq for StorageEntryModifier

impl StructuralEq for StorageMetadata

impl StructuralEq for RuntimeMetadataPrefixed

impl StructuralEq for ExtrinsicMetadata

impl StructuralEq for RuntimeMetadata

impl StructuralEq for RuntimeMetadataDeprecated

impl StructuralEq for RuntimeMetadataV13

impl StructuralEq for ModuleMetadata

impl<T: Config> StructuralEq for Module<T>

impl<T: Config + Send + Sync> StructuralEq for CheckGenesis<T>

impl<T: Config + Send + Sync> StructuralEq for CheckMortality<T>

impl<T: Config> StructuralEq for CheckNonce<T>

impl<T: Config + Send + Sync> StructuralEq for CheckSpecVersion<T>

impl<T: Config + Send + Sync> StructuralEq for CheckTxVersion<T>

impl<T: Config + Send + Sync> StructuralEq for CheckWeight<T>

impl StructuralEq for Phase

impl<E: Parameter + Member, T> StructuralEq for EventRecord<E, T>

impl<AccountId> StructuralEq for RawOrigin<AccountId>

impl<Index, AccountData> StructuralEq for AccountInfo<Index, AccountData>

impl StructuralEq for IncRefStatus

impl StructuralEq for DecRefStatus

impl StructuralEq for ProxyType

impl StructuralEq for SessionKeys

impl StructuralEq for NposSolution16

impl StructuralEq for Runtime

impl StructuralEq for Event

impl StructuralEq for OriginCaller

impl StructuralEq for Call

impl StructuralEq for SessionKeys

impl StructuralEq for Runtime

impl StructuralEq for Event

impl StructuralEq for OriginCaller

impl StructuralEq for Call

impl<Balance, AccountId, DepositBalance> StructuralEq for AssetDetails<Balance, AccountId, DepositBalance>

impl<Balance, DepositBalance> StructuralEq for Approval<Balance, DepositBalance>

impl<Balance, Extra> StructuralEq for AssetBalance<Balance, Extra>

impl<DepositBalance, BoundedString> StructuralEq for AssetMetadata<DepositBalance, BoundedString>

impl StructuralEq for DestroyWitness

impl StructuralEq for ConversionError

impl<T: Config> StructuralEq for PendingSwap<T>

impl<AccountId, C: ReservableCurrency<AccountId>> StructuralEq for BalanceSwapAction<AccountId, C>

impl StructuralEq for Reasons

impl<Balance> StructuralEq for BalanceLock<Balance>

impl<ReserveIdentifier, Balance> StructuralEq for ReserveData<ReserveIdentifier, Balance>

impl<Balance> StructuralEq for AccountData<Balance>

impl<T: Config<I>, I: 'static> StructuralEq for PositiveImbalance<T, I>

impl<T: Config<I>, I: 'static> StructuralEq for NegativeImbalance<T, I>

impl<AccountId, Balance, BlockNumber> StructuralEq for Bounty<AccountId, Balance, BlockNumber>

impl<AccountId, BlockNumber> StructuralEq for BountyStatus<AccountId, BlockNumber>

impl<Balance, AccountId> StructuralEq for RawEvent<Balance, AccountId>

impl<T: Config> StructuralEq for Module<T>

impl<AccountId, I> StructuralEq for RawOrigin<AccountId, I>

impl<AccountId, BlockNumber> StructuralEq for Votes<AccountId, BlockNumber>

impl StructuralEq for Instance1

impl StructuralEq for Instance2

impl StructuralEq for Instance3

impl StructuralEq for Instance4

impl StructuralEq for Instance5

impl StructuralEq for Instance6

impl StructuralEq for Instance7

impl StructuralEq for Instance8

impl StructuralEq for Instance9

impl StructuralEq for Instance10

impl StructuralEq for Instance11

impl StructuralEq for Instance12

impl StructuralEq for Instance13

impl StructuralEq for Instance14

impl StructuralEq for Instance15

impl StructuralEq for Instance16

impl StructuralEq for DefaultInstance

impl<Hash, AccountId, I> StructuralEq for RawEvent<Hash, AccountId, I>

impl<T: Config<I>, I: Instance> StructuralEq for Module<T, I>

impl<T: Config> StructuralEq for Schedule<T>

impl StructuralEq for Limits

impl<T: Config> StructuralEq for InstructionWeights<T>

impl<T: Config> StructuralEq for HostFnWeights<T>

impl<T> StructuralEq for ContractResult<T>

impl StructuralEq for ContractAccessError

impl<BlockNumber> StructuralEq for RentProjection<BlockNumber>

impl StructuralEq for ReturnFlags

impl StructuralEq for ExecReturnValue

impl<AccountId, BlockNumber> StructuralEq for InstantiateReturnValue<AccountId, BlockNumber>

impl<Hash> StructuralEq for Code<Hash>

impl StructuralEq for Conviction

impl<Balance> StructuralEq for Tally<Balance>

impl<Balance> StructuralEq for Delegations<Balance>

impl<BlockNumber, Hash, Balance> StructuralEq for ReferendumStatus<BlockNumber, Hash, Balance>

impl<BlockNumber, Hash, Balance> StructuralEq for ReferendumInfo<BlockNumber, Hash, Balance>

impl StructuralEq for Vote

impl<Balance> StructuralEq for AccountVote<Balance>

impl<Balance, AccountId, BlockNumber> StructuralEq for Voting<Balance, AccountId, BlockNumber>

impl StructuralEq for VoteThreshold

impl<AccountId, Balance: HasCompact, Solution> StructuralEq for SignedSubmission<AccountId, Balance, Solution>

impl StructuralEq for MinerError

impl<Bn> StructuralEq for Phase<Bn>

impl StructuralEq for ElectionCompute

impl<S> StructuralEq for RawSolution<S>

impl<A> StructuralEq for ReadySolution<A>

impl<A> StructuralEq for RoundSnapshot<A>

impl StructuralEq for SolutionOrSnapshotSize

impl StructuralEq for ElectionError

impl StructuralEq for FeasibilityError

impl<Balance> StructuralEq for VoterInfo<Balance>

impl StructuralEq for CellStatus

impl<T: Config + Send + Sync> StructuralEq for WatchDummy<T>

impl StructuralEq for Public

impl StructuralEq for Signature

impl<Public, BlockNumber> StructuralEq for PricePayload<Public, BlockNumber>

impl StructuralEq for EnlistedParticipant

impl<Balance, AccountId> StructuralEq for GiltBid<Balance, AccountId>

impl<Balance, AccountId, BlockNumber> StructuralEq for ActiveGilt<Balance, AccountId, BlockNumber>

impl<Balance> StructuralEq for ActiveGiltsTotal<Balance>

impl StructuralEq for GrandpaTimeSlot

impl StructuralEq for Data

impl<Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq> StructuralEq for Judgement<Balance>

impl StructuralEq for IdentityField

impl<FieldLimit: Get<u32>> StructuralEq for IdentityInfo<FieldLimit>

impl<Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq, MaxJudgements: Get<u32>, MaxAdditionalFields: Get<u32>> StructuralEq for Registration<Balance, MaxJudgements, MaxAdditionalFields>

impl<Balance: Encode + Decode + Clone + Debug + Eq + PartialEq, AccountId: Encode + Decode + Clone + Debug + Eq + PartialEq> StructuralEq for RegistrarInfo<Balance, AccountId>

impl<BlockNumber> StructuralEq for Heartbeat<BlockNumber> where
    BlockNumber: PartialEq + Eq + Decode + Encode, 

impl<Offender> StructuralEq for UnresponsivenessOffence<Offender>

impl<BlockNumber, Balance> StructuralEq for LotteryConfig<BlockNumber, Balance>

impl StructuralEq for Instance1

impl StructuralEq for Instance2

impl StructuralEq for Instance3

impl StructuralEq for Instance4

impl StructuralEq for Instance5

impl StructuralEq for Instance6

impl StructuralEq for Instance7

impl StructuralEq for Instance8

impl StructuralEq for Instance9

impl StructuralEq for Instance10

impl StructuralEq for Instance11

impl StructuralEq for Instance12

impl StructuralEq for Instance13

impl StructuralEq for Instance14

impl StructuralEq for Instance15

impl StructuralEq for Instance16

impl StructuralEq for DefaultInstance

impl<AccountId, Event, I> StructuralEq for RawEvent<AccountId, Event, I>

impl<T: Config<I>, I: Instance> StructuralEq for Module<T, I>

impl<Hash> StructuralEq for Proof<Hash>

impl StructuralEq for Error

impl StructuralEq for EncodableOpaqueLeaf

impl<BlockHash> StructuralEq for LeafProof<BlockHash>

impl<BlockNumber> StructuralEq for Timepoint<BlockNumber>

impl<BlockNumber, Balance, AccountId> StructuralEq for Multisig<BlockNumber, Balance, AccountId>

impl<AccountId, ProxyType, BlockNumber> StructuralEq for ProxyDefinition<AccountId, ProxyType, BlockNumber>

impl<AccountId, Hash, BlockNumber> StructuralEq for Announcement<AccountId, Hash, BlockNumber>

impl<BlockNumber, Balance, AccountId> StructuralEq for ActiveRecovery<BlockNumber, Balance, AccountId>

impl<BlockNumber, Balance, AccountId> StructuralEq for RecoveryConfig<BlockNumber, Balance, AccountId>

impl<Call, BlockNumber, PalletsOrigin, AccountId> StructuralEq for ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId>

impl<T: Config> StructuralEq for Module<T>

impl StructuralEq for Event

impl<T: Config> StructuralEq for Module<T>

impl StructuralEq for Vote

impl StructuralEq for Judgement

impl<Balance, BlockNumber> StructuralEq for Payout<Balance, BlockNumber>

impl StructuralEq for VouchingStatus

impl<AccountId, Balance> StructuralEq for Bid<AccountId, Balance>

impl<AccountId, Balance> StructuralEq for BidKind<AccountId, Balance>

impl StructuralEq for Instance1

impl StructuralEq for Instance2

impl StructuralEq for Instance3

impl StructuralEq for Instance4

impl StructuralEq for Instance5

impl StructuralEq for Instance6

impl StructuralEq for Instance7

impl StructuralEq for Instance8

impl StructuralEq for Instance9

impl StructuralEq for Instance10

impl StructuralEq for Instance11

impl StructuralEq for Instance12

impl StructuralEq for Instance13

impl StructuralEq for Instance14

impl StructuralEq for Instance15

impl StructuralEq for Instance16

impl StructuralEq for DefaultInstance

impl<T: Config<I>, I: Instance> StructuralEq for Module<T, I>

impl<AccountId, Balance, I> StructuralEq for RawEvent<AccountId, Balance, I>

impl<AccountId> StructuralEq for RewardDestination<AccountId>

impl StructuralEq for ValidatorPrefs

impl<Balance: HasCompact> StructuralEq for UnlockChunk<Balance>

impl<AccountId, Balance: HasCompact> StructuralEq for StakingLedger<AccountId, Balance>

impl<AccountId> StructuralEq for Nominations<AccountId>

impl<AccountId, Balance: HasCompact> StructuralEq for IndividualExposure<AccountId, Balance>

impl<AccountId, Balance: HasCompact> StructuralEq for Exposure<AccountId, Balance>

impl StructuralEq for Forcing

impl<AccountId: Parameter, Balance: Parameter, BlockNumber: Parameter, Hash: Parameter> StructuralEq for OpenTip<AccountId, Balance, BlockNumber, Hash>

impl<Balance, AccountId, Hash> StructuralEq for RawEvent<Balance, AccountId, Hash>

impl<T: Config> StructuralEq for Module<T>

impl<Balance> StructuralEq for InclusionFee<Balance>

impl<Balance> StructuralEq for FeeDetails<Balance>

impl<Balance> StructuralEq for RuntimeDispatchInfo<Balance>

impl<T: Config> StructuralEq for ChargeTransactionPayment<T>

impl StructuralEq for TransactionInfo

impl<AccountId, Balance> StructuralEq for Proposal<AccountId, Balance>

impl<AccountId, DepositBalance> StructuralEq for ClassDetails<AccountId, DepositBalance>

impl StructuralEq for DestroyWitness

impl<AccountId, DepositBalance> StructuralEq for InstanceDetails<AccountId, DepositBalance>

impl<DepositBalance, StringLimit: Get<u32>> StructuralEq for ClassMetadata<DepositBalance, StringLimit>

impl<DepositBalance, StringLimit: Get<u32>> StructuralEq for InstanceMetadata<DepositBalance, StringLimit>

impl<Balance, BlockNumber> StructuralEq for VestingInfo<Balance, BlockNumber>

impl StructuralEq for TracingReceiver

impl StructuralEq for NodeKeyType

impl StructuralEq for CryptoScheme

impl StructuralEq for OutputType

impl StructuralEq for ExecutionStrategy

impl StructuralEq for NewBlockState

impl<H, N> StructuralEq for LeafSet<H, N>

impl<Header: HeaderT> StructuralEq for RemoteCallRequest<Header>

impl<Header: HeaderT> StructuralEq for RemoteHeaderRequest<Header>

impl<Header: HeaderT> StructuralEq for RemoteReadRequest<Header>

impl<Header: HeaderT> StructuralEq for RemoteReadChildRequest<Header>

impl<Header: HeaderT> StructuralEq for RemoteChangesRequest<Header>

impl<Header: HeaderT> StructuralEq for ChangesProof<Header>

impl<Header: HeaderT> StructuralEq for RemoteBodyRequest<Header>

impl StructuralEq for ImportResult

impl StructuralEq for ImportedAux

impl StructuralEq for ForkChoiceStrategy

impl<Block: BlockT> StructuralEq for BlockCheckParams<Block>

impl<B: BlockT> StructuralEq for ImportedState<B>

impl<B: BlockT> StructuralEq for IncomingBlock<B>

impl StructuralEq for Epoch

impl<E: Epoch> StructuralEq for EpochHeader<E>

impl StructuralEq for EpochIdentifierPosition

impl<Hash, Number> StructuralEq for EpochIdentifier<Hash, Number>

impl<Hash, Number, E: Epoch> StructuralEq for ViableEpochDescriptor<Hash, Number, E>

impl<E: Epoch> StructuralEq for PersistedEpochHeader<E>

impl<Hash> StructuralEq for CreatedBlock<Hash>

impl<H, D> StructuralEq for MiningMetadata<H, D>

impl<T> StructuralEq for SlotDuration<T>

impl StructuralEq for WasmExecutionMethod

impl<Block: BlockT> StructuralEq for GrandpaJustification<Block>

impl StructuralEq for SyncState

impl StructuralEq for StateDownloadProgress

impl StructuralEq for WarpSyncPhase

impl StructuralEq for WarpSyncProgress

impl StructuralEq for IfDisconnected

impl StructuralEq for ProtocolId

impl StructuralEq for SyncMode

impl StructuralEq for NonReservedPeerMode

impl StructuralEq for TopicNotification

impl StructuralEq for MessageIntent

impl StructuralEq for SetId

impl StructuralEq for ReputationChange

impl StructuralEq for IncomingIndex

impl StructuralEq for Constraints

impl StructuralEq for PruningMode

impl StructuralEq for TelemetryEndpoints

impl<Hash, Extrinsic> StructuralEq for Transaction<Hash, Extrinsic>

impl StructuralEq for Public

impl StructuralEq for Signature

impl StructuralEq for Public

impl StructuralEq for Signature

impl StructuralEq for Public

impl StructuralEq for Signature

impl StructuralEq for FixedI64

impl StructuralEq for FixedI128

impl StructuralEq for FixedU128

impl StructuralEq for Percent

impl StructuralEq for PerU16

impl StructuralEq for Permill

impl StructuralEq for Perbill

impl StructuralEq for Perquintill

impl StructuralEq for RationalInfinite

impl StructuralEq for Rational128

impl<Block: BlockT> StructuralEq for Info<Block>

impl StructuralEq for BlockStatus

impl StructuralEq for Validation

impl StructuralEq for BlockStatus

impl StructuralEq for BlockOrigin

impl StructuralEq for NextEpochDescriptor

impl StructuralEq for NextConfigDescriptor

impl StructuralEq for ConsensusLog

impl StructuralEq for BabeGenesisConfigurationV1

impl StructuralEq for BabeGenesisConfiguration

impl StructuralEq for AllowedSlots

impl StructuralEq for BabeEpochConfiguration

impl StructuralEq for Epoch

impl StructuralEq for Slot

impl StructuralEq for VRFOutput

impl StructuralEq for VRFProof

impl StructuralEq for SecretStringError

impl StructuralEq for DeriveJunction

impl StructuralEq for PublicError

impl StructuralEq for Ss58AddressFormat

impl StructuralEq for ParseError

impl StructuralEq for AccountId32

impl StructuralEq for Dummy

impl StructuralEq for KeyTypeId

impl StructuralEq for CryptoTypeId

impl StructuralEq for CryptoTypePublicPair

impl StructuralEq for ChangesTrieConfiguration

impl<Number, Hash> StructuralEq for ChangesTrieConfigurationRange<Number, Hash>

impl StructuralEq for PublicError

impl StructuralEq for Public

impl StructuralEq for LocalizedSignature

impl StructuralEq for PublicError

impl StructuralEq for PendingRequest

impl StructuralEq for StorageKind

impl StructuralEq for HttpRequestId

impl StructuralEq for HttpError

impl StructuralEq for HttpRequestStatus

impl StructuralEq for OpaqueNetworkState

impl StructuralEq for OpaqueMultiaddr

impl StructuralEq for Timestamp

impl StructuralEq for Duration

impl StructuralEq for Capability

impl StructuralEq for Capabilities

impl StructuralEq for OffchainOverlayedChange

impl StructuralEq for ExternEntity

impl StructuralEq for Entry

impl StructuralEq for EnvironmentDefinition

impl StructuralEq for Public

impl StructuralEq for LocalizedSignature

impl StructuralEq for Bytes

impl StructuralEq for OpaquePeerId

impl StructuralEq for Void

impl<N> StructuralEq for ScheduledChange<N>

impl<N: Codec> StructuralEq for ConsensusLog<N>

impl StructuralEq for Keyring

impl StructuralEq for Keyring

impl<AccountId, P: PerThing> StructuralEq for Assignment<AccountId, P>

impl<AccountId> StructuralEq for StakedAssignment<AccountId>

impl<VoterIndex, TargetIndex, P: PerThing> StructuralEq for IndexAssignment<VoterIndex, TargetIndex, P>

impl StructuralEq for Error

impl<AccountId> StructuralEq for Support<AccountId>

impl<'a> StructuralEq for PiecewiseLinear<'a>

impl<Block: BlockT> StructuralEq for BlockId<Block>

impl<Header, Extrinsic: MaybeSerialize> StructuralEq for Block<Header, Extrinsic>

impl<Block> StructuralEq for SignedBlock<Block>

impl<AccountId, Call, Extra> StructuralEq for CheckedExtrinsic<AccountId, Call, Extra>

impl<Hash> StructuralEq for Digest<Hash>

impl<Hash> StructuralEq for DigestItem<Hash>

impl StructuralEq for ChangesTrieSignal

impl<'a, Hash: 'a> StructuralEq for DigestItemRef<'a, Hash>

impl<'a> StructuralEq for OpaqueDigestItemId<'a>

impl StructuralEq for Era

impl<Number: Copy + Into<U256> + TryFrom<U256>, Hash: HashT> StructuralEq for Header<Number, Hash>

impl<Address, Call, Signature, Extra> StructuralEq for UncheckedExtrinsic<Address, Call, Signature, Extra> where
    Extra: SignedExtension

impl<AccountId, AccountIndex> StructuralEq for MultiAddress<AccountId, AccountIndex>

impl StructuralEq for Method

impl<'a, T> StructuralEq for Request<'a, T>

impl StructuralEq for Error

impl StructuralEq for PendingRequest

impl StructuralEq for Headers

impl StructuralEq for StorageRetrievalError

impl<T, E> StructuralEq for MutateStorageError<T, E>

impl<B: BlockNumberProvider> StructuralEq for BlockAndTimeDeadline<B>

impl StructuralEq for RuntimeString

impl StructuralEq for UintAuthorityId

impl StructuralEq for TestSignature

impl<Xt> StructuralEq for ExtrinsicWrapper<Xt>

impl<Xt> StructuralEq for Block<Xt>

impl<Call, Extra> StructuralEq for TestXt<Call, Extra>

impl StructuralEq for BlakeTwo256

impl StructuralEq for Keccak256

impl StructuralEq for InvalidTransaction

impl StructuralEq for UnknownTransaction

impl StructuralEq for TransactionValidityError

impl StructuralEq for TransactionSource

impl StructuralEq for ValidTransaction

impl StructuralEq for Justifications

impl StructuralEq for MultiSignature

impl StructuralEq for MultiSigner

impl StructuralEq for AnySignature

impl StructuralEq for DispatchError

impl<Info> StructuralEq for DispatchErrorWithPostInfo<Info> where
    Info: Eq + PartialEq + Clone + Copy + Encode + Decode + Printable

impl StructuralEq for TokenError

impl StructuralEq for ArithmeticError

impl StructuralEq for OpaqueExtrinsic

impl StructuralEq for MembershipProof

impl<Reporter, Offender> StructuralEq for OffenceDetails<Reporter, Offender>

impl StructuralEq for ExecutionError

impl StructuralEq for ExecutionStrategy

impl StructuralEq for StorageKey

impl StructuralEq for TrackedStorageKey

impl StructuralEq for PrefixedStorageKey

impl StructuralEq for StorageData

impl StructuralEq for StorageChild

impl<Hash> StructuralEq for StorageChangeSet<Hash>

impl StructuralEq for ChildInfo

impl StructuralEq for ChildTrieParentKeyId

impl StructuralEq for Extrinsic

impl StructuralEq for Timestamp

impl StructuralEq for Error

impl StructuralEq for StorageProof

impl StructuralEq for CompactProof

impl StructuralEq for Error

impl StructuralEq for RuntimeVersion

impl StructuralEq for ValueType

impl<T: PointerType> StructuralEq for Pointer<T>

impl StructuralEq for Signature

impl<V> StructuralEq for StorageQuery<V>

impl<T: Config> StructuralEq for Module<T>

impl StructuralEq for Transfer

impl StructuralEq for Extrinsic

impl StructuralEq for Runtime

impl StructuralEq for Event

impl StructuralEq for SessionKeys