Trait wasmtime_environ::__core::marker::StructuralEq
source · 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.
Implementors§
impl StructuralEq for EntityIndex
impl StructuralEq for FlagValue
impl StructuralEq for GlobalInit
impl StructuralEq for Trap
impl StructuralEq for WasmHeapType
impl StructuralEq for WasmType
impl StructuralEq for BlockType
impl StructuralEq for CanonicalOption
impl StructuralEq for ComponentExternalKind
impl StructuralEq for ComponentOuterAliasKind
impl StructuralEq for ComponentTypeRef
impl StructuralEq for ComponentValType
impl StructuralEq for wasmtime_environ::wasmparser::Encoding
impl StructuralEq for ExternalKind
impl StructuralEq for FrameKind
impl StructuralEq for HeapType
impl StructuralEq for InstantiationArgKind
impl StructuralEq for OuterAliasKind
impl StructuralEq for PrimitiveValType
impl StructuralEq for StorageType
impl StructuralEq for TypeBounds
impl StructuralEq for ValType
impl StructuralEq for AsciiChar
impl StructuralEq for wasmtime_environ::__core::cmp::Ordering
impl StructuralEq for wasmtime_environ::__core::fmt::Alignment
impl StructuralEq for IpAddr
impl StructuralEq for Ipv6MulticastScope
impl StructuralEq for SocketAddr
impl StructuralEq for FpCategory
impl StructuralEq for IntErrorKind
impl StructuralEq for Which
impl StructuralEq for SearchStep
impl StructuralEq for wasmtime_environ::__core::sync::atomic::Ordering
impl StructuralEq for TryReserveErrorKind
impl StructuralEq for BacktraceStatus
impl StructuralEq for VarError
impl StructuralEq for SeekFrom
impl StructuralEq for ErrorKind
impl StructuralEq for Shutdown
impl StructuralEq for BacktraceStyle
impl StructuralEq for RecvTimeoutError
impl StructuralEq for TryRecvError
impl StructuralEq for DwarfFileType
impl StructuralEq for Format
impl StructuralEq for gimli::common::SectionId
impl StructuralEq for RunTimeEndian
impl StructuralEq for Pointer
impl StructuralEq for gimli::read::Error
impl StructuralEq for ColumnType
impl StructuralEq for ValueType
impl StructuralEq for gimli::write::cfi::CallFrameInstruction
impl StructuralEq for ConvertError
impl StructuralEq for Address
impl StructuralEq for gimli::write::Error
impl StructuralEq for Reference
impl StructuralEq for LineString
impl StructuralEq for gimli::write::loc::Location
impl StructuralEq for gimli::write::range::Range
impl StructuralEq for gimli::write::unit::AttributeValue
impl StructuralEq for Level
impl StructuralEq for LevelFilter
impl StructuralEq for AddressSize
impl StructuralEq for object::common::Architecture
impl StructuralEq for object::common::BinaryFormat
impl StructuralEq for ComdatKind
impl StructuralEq for FileFlags
impl StructuralEq for RelocationEncoding
impl StructuralEq for RelocationKind
impl StructuralEq for SectionFlags
impl StructuralEq for SectionKind
impl StructuralEq for SegmentFlags
impl StructuralEq for SymbolKind
impl StructuralEq for SymbolScope
impl StructuralEq for object::endian::Endianness
impl StructuralEq for CompressionFormat
impl StructuralEq for FileKind
impl StructuralEq for ObjectKind
impl StructuralEq for RelocationTarget
impl StructuralEq for object::read::SymbolSection
impl StructuralEq for Mangling
impl StructuralEq for StandardSection
impl StructuralEq for StandardSegment
impl StructuralEq for object::write::SymbolSection
impl StructuralEq for Op
impl StructuralEq for CDataModel
impl StructuralEq for Size
impl StructuralEq for ParseError
impl StructuralEq for Aarch64Architecture
impl StructuralEq for target_lexicon::targets::Architecture
impl StructuralEq for ArmArchitecture
impl StructuralEq for target_lexicon::targets::BinaryFormat
impl StructuralEq for CustomVendor
impl StructuralEq for Environment
impl StructuralEq for Mips32Architecture
impl StructuralEq for Mips64Architecture
impl StructuralEq for OperatingSystem
impl StructuralEq for Riscv32Architecture
impl StructuralEq for Riscv64Architecture
impl StructuralEq for Vendor
impl StructuralEq for X86_32Architecture
impl StructuralEq for CallingConvention
impl StructuralEq for target_lexicon::triple::Endianness
impl StructuralEq for PointerWidth
impl StructuralEq for bool
impl StructuralEq for char
impl StructuralEq for i8
impl StructuralEq for i16
impl StructuralEq for i32
impl StructuralEq for i64
impl StructuralEq for i128
impl StructuralEq for isize
impl StructuralEq for str
impl StructuralEq for u8
impl StructuralEq for u16
impl StructuralEq for u32
impl StructuralEq for u64
impl StructuralEq for u128
impl StructuralEq for ()
impl StructuralEq for usize
impl StructuralEq for DataIndex
impl StructuralEq for DefinedFuncIndex
impl StructuralEq for DefinedGlobalIndex
impl StructuralEq for DefinedMemoryIndex
impl StructuralEq for DefinedTableIndex
impl StructuralEq for ElemIndex
impl StructuralEq for FilePos
impl StructuralEq for FuncIndex
impl StructuralEq for FuncRefIndex
impl StructuralEq for Global
impl StructuralEq for GlobalIndex
impl StructuralEq for InstructionAddressMap
impl StructuralEq for Memory
impl StructuralEq for MemoryIndex
impl StructuralEq for OwnedMemoryIndex
impl StructuralEq for SignatureIndex
impl StructuralEq for StaticModuleIndex
impl StructuralEq for Table
impl StructuralEq for TableIndex
impl StructuralEq for Tag
impl StructuralEq for TagIndex
impl StructuralEq for TrapInformation
impl StructuralEq for TypeIndex
impl StructuralEq for WasmFuncType
impl StructuralEq for WasmRefType
impl StructuralEq for KebabStr
impl StructuralEq for KebabString
impl StructuralEq for ArrayType
impl StructuralEq for FieldType
impl StructuralEq for FuncType
impl StructuralEq for GlobalType
impl StructuralEq for Ieee32
impl StructuralEq for Ieee64
impl StructuralEq for MemoryType
impl StructuralEq for RefType
impl StructuralEq for StructType
impl StructuralEq for TableType
impl StructuralEq for V128
impl StructuralEq for ResourceId
impl StructuralEq for wasmtime_environ::wasmparser::types::TypeId
impl StructuralEq for AllocError
impl StructuralEq for Layout
impl StructuralEq for LayoutError
impl StructuralEq for wasmtime_environ::__core::any::TypeId
impl StructuralEq for CpuidResult
impl StructuralEq for CharTryFromError
impl StructuralEq for DecodeUtf16Error
impl StructuralEq for ParseCharError
impl StructuralEq for TryFromCharError
impl StructuralEq for FromBytesUntilNulError
impl StructuralEq for FromBytesWithNulError
impl StructuralEq for wasmtime_environ::__core::fmt::Error
impl StructuralEq for Assume
impl StructuralEq for AddrParseError
impl StructuralEq for Ipv4Addr
impl StructuralEq for Ipv6Addr
impl StructuralEq for SocketAddrV4
impl StructuralEq for SocketAddrV6
impl StructuralEq for NonZeroI8
impl StructuralEq for NonZeroI16
impl StructuralEq for NonZeroI32
impl StructuralEq for NonZeroI64
impl StructuralEq for NonZeroI128
impl StructuralEq for NonZeroIsize
impl StructuralEq for NonZeroU8
impl StructuralEq for NonZeroU16
impl StructuralEq for NonZeroU32
impl StructuralEq for NonZeroU64
impl StructuralEq for NonZeroU128
impl StructuralEq for NonZeroUsize
impl StructuralEq for ParseFloatError
impl StructuralEq for ParseIntError
impl StructuralEq for TryFromIntError
impl StructuralEq for RangeFull
impl StructuralEq for wasmtime_environ::__core::ptr::Alignment
impl StructuralEq for ParseBoolError
impl StructuralEq for Utf8Error
impl StructuralEq for Duration
impl StructuralEq for TryFromFloatSecsError
impl StructuralEq for alloc::collections::TryReserveError
impl StructuralEq for CString
impl StructuralEq for FromVecWithNulError
impl StructuralEq for IntoStringError
impl StructuralEq for NulError
impl StructuralEq for FromUtf8Error
impl StructuralEq for String
impl StructuralEq for FileType
impl StructuralEq for Permissions
impl StructuralEq for InvalidHandleError
impl StructuralEq for NullHandleError
impl StructuralEq for StripPrefixError
impl StructuralEq for ExitStatus
impl StructuralEq for ExitStatusError
impl StructuralEq for Output
impl StructuralEq for WaitTimeoutResult
impl StructuralEq for RecvError
impl StructuralEq for AccessError
impl StructuralEq for ThreadId
impl StructuralEq for Instant
impl StructuralEq for SystemTime
impl StructuralEq for DebugTypeSignature
impl StructuralEq for DwoId
impl StructuralEq for gimli::common::Encoding
impl StructuralEq for LineEncoding
impl StructuralEq for Register
impl StructuralEq for DwAccess
impl StructuralEq for DwAddr
impl StructuralEq for DwAt
impl StructuralEq for DwAte
impl StructuralEq for DwCc
impl StructuralEq for DwCfa
impl StructuralEq for DwChildren
impl StructuralEq for DwDefaulted
impl StructuralEq for DwDs
impl StructuralEq for DwDsc
impl StructuralEq for DwEhPe
impl StructuralEq for DwEnd
impl StructuralEq for DwForm
impl StructuralEq for DwId
impl StructuralEq for DwIdx
impl StructuralEq for DwInl
impl StructuralEq for DwLang
impl StructuralEq for DwLle
impl StructuralEq for DwLnct
impl StructuralEq for DwLne
impl StructuralEq for DwLns
impl StructuralEq for DwMacro
impl StructuralEq for DwOp
impl StructuralEq for DwOrd
impl StructuralEq for DwRle
impl StructuralEq for DwSect
impl StructuralEq for DwSectV2
impl StructuralEq for DwTag
impl StructuralEq for DwUt
impl StructuralEq for DwVirtuality
impl StructuralEq for DwVis
impl StructuralEq for gimli::endianity::BigEndian
impl StructuralEq for gimli::endianity::LittleEndian
impl StructuralEq for Abbreviation
impl StructuralEq for AttributeSpecification
impl StructuralEq for ArangeEntry
impl StructuralEq for Augmentation
impl StructuralEq for BaseAddresses
impl StructuralEq for SectionBaseAddresses
impl StructuralEq for UnitIndexSection
impl StructuralEq for FileEntryFormat
impl StructuralEq for LineRow
impl StructuralEq for ReaderOffsetId
impl StructuralEq for gimli::read::rnglists::Range
impl StructuralEq for StoreOnHeap
impl StructuralEq for CieId
impl StructuralEq for gimli::write::cfi::CommonInformationEntry
impl StructuralEq for gimli::write::cfi::FrameDescriptionEntry
impl StructuralEq for FileId
impl StructuralEq for DirectoryId
impl StructuralEq for FileInfo
impl StructuralEq for LocationList
impl StructuralEq for LocationListId
impl StructuralEq for gimli::write::op::Expression
impl StructuralEq for RangeList
impl StructuralEq for RangeListId
impl StructuralEq for LineStringId
impl StructuralEq for gimli::write::str::StringId
impl StructuralEq for gimli::write::unit::Attribute
impl StructuralEq for UnitEntryId
impl StructuralEq for UnitId
impl StructuralEq for indexmap::TryReserveError
impl StructuralEq for object::endian::BigEndian
impl StructuralEq for object::endian::LittleEndian
impl StructuralEq for CompressedFileRange
impl StructuralEq for object::read::Error
impl StructuralEq for object::read::SectionIndex
impl StructuralEq for object::read::SymbolIndex
impl StructuralEq for object::write::elf::writer::SectionIndex
impl StructuralEq for object::write::elf::writer::SymbolIndex
impl StructuralEq for object::write::string::StringId
impl StructuralEq for ComdatId
impl StructuralEq for object::write::Error
impl StructuralEq for object::write::SectionId
impl StructuralEq for SymbolId
impl StructuralEq for BuildMetadata
impl StructuralEq for Comparator
impl StructuralEq for Prerelease
impl StructuralEq for Version
impl StructuralEq for VersionReq
impl StructuralEq for Triple
impl StructuralEq for PhantomPinned
impl StructuralEq for TryReserveError
impl StructuralEq for TryReserveError
impl<'a> StructuralEq for ComponentDefinedType<'a>
impl<'a> StructuralEq for Component<'a>
impl<'a> StructuralEq for Prefix<'a>
impl<'a> StructuralEq for VariantCase<'a>
impl<'a> StructuralEq for wasmtime_environ::__core::panic::Location<'a>
impl<'a> StructuralEq for Utf8Chunk<'a>
impl<'a> StructuralEq for PrefixComponent<'a>
impl<'a> StructuralEq for Metadata<'a>
impl<'a> StructuralEq for MetadataBuilder<'a>
impl<'bases, Section, R> StructuralEq for CieOrFde<'bases, Section, R>where R: Reader, Section: UnwindSection<R>,
impl<'bases, Section, R> StructuralEq for PartialFrameDescriptionEntry<'bases, Section, R>where R: Reader, Section: UnwindSection<R>,
impl<'data> StructuralEq for CodeView<'data>
impl<'data> StructuralEq for CompressedData<'data>
impl<'data> StructuralEq for Export<'data>
impl<'data> StructuralEq for Import<'data>
impl<'data> StructuralEq for ObjectMapEntry<'data>
impl<'data> StructuralEq for SymbolMapName<'data>
impl<'data> StructuralEq for Bytes<'data>
impl<'input, Endian> StructuralEq for EndianSlice<'input, Endian>where Endian: Endianity,
impl<B, C> StructuralEq for ControlFlow<B, C>
impl<E> StructuralEq for I16<E>where E: Endian,
impl<E> StructuralEq for I32<E>where E: Endian,
impl<E> StructuralEq for I64<E>where E: Endian,
impl<E> StructuralEq for U16<E>where E: Endian,
impl<E> StructuralEq for U32<E>where E: Endian,
impl<E> StructuralEq for U64<E>where E: Endian,
impl<E> StructuralEq for I16Bytes<E>where E: Endian,
impl<E> StructuralEq for I32Bytes<E>where E: Endian,
impl<E> StructuralEq for I64Bytes<E>where E: Endian,
impl<E> StructuralEq for U16Bytes<E>where E: Endian,
impl<E> StructuralEq for U32Bytes<E>where E: Endian,
impl<E> StructuralEq for U64Bytes<E>where E: Endian,
impl<Idx> StructuralEq for wasmtime_environ::__core::ops::Range<Idx>
impl<Idx> StructuralEq for RangeFrom<Idx>
impl<Idx> StructuralEq for RangeInclusive<Idx>
impl<Idx> StructuralEq for RangeTo<Idx>
impl<Idx> StructuralEq for RangeToInclusive<Idx>
impl<K, V> StructuralEq for PrimaryMap<K, V>where K: EntityRef,
impl<Offset> StructuralEq for UnitType<Offset>where Offset: ReaderOffset,
impl<R> StructuralEq for gimli::read::cfi::CallFrameInstruction<R>where R: Reader,
impl<R> StructuralEq for CfaRule<R>where R: Reader,
impl<R> StructuralEq for RegisterRule<R>where R: Reader,
impl<R> StructuralEq for DebugFrame<R>where R: Reader,
impl<R> StructuralEq for EhFrame<R>where R: Reader,
impl<R> StructuralEq for EhFrameHdr<R>where R: Reader,
impl<R> StructuralEq for LocationListEntry<R>where R: Reader,
impl<R> StructuralEq for gimli::read::op::Expression<R>where R: Reader,
impl<R> StructuralEq for gimli::read::unit::Attribute<R>where R: Reader,
impl<R, A> StructuralEq for UnwindContext<R, A>where R: Reader, A: UnwindContextStorage<R>,
impl<R, Offset> StructuralEq for LineInstruction<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for Operation<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for gimli::read::unit::AttributeValue<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for ArangeHeader<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for gimli::read::cfi::CommonInformationEntry<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for gimli::read::cfi::FrameDescriptionEntry<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
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<R, Offset> StructuralEq for IncompleteLineProgram<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for LineProgramHeader<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, Offset> StructuralEq for UnitHeader<R, Offset>where R: Reader<Offset = Offset>, Offset: ReaderOffset,
impl<R, S> StructuralEq for UnwindTableRow<R, S>where R: Reader, S: UnwindContextStorage<R>,
impl<Section, Symbol> StructuralEq for SymbolFlags<Section, Symbol>
impl<T> StructuralEq for Bound<T>
impl<T> StructuralEq for Option<T>
impl<T> StructuralEq for Poll<T>
impl<T> StructuralEq for TrySendError<T>
impl<T> StructuralEq for UnitSectionOffset<T>
impl<T> StructuralEq for DieReference<T>
impl<T> StructuralEq for &Twhere T: ?Sized,
impl<T> StructuralEq for [T]
impl<T> StructuralEq for (T₁, T₂, …, Tₙ)
This trait is implemented for tuples up to twelve items long.