Trait orkhon::prelude::ops::nn::tract_downcast_rs::__std::marker::StructuralEq [−][src]
structural_match
)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<'a> StructuralEq for Utf8LossyChunk<'a>
[src]
impl StructuralEq for Level
[src]
impl StructuralEq for LevelFilter
[src]
impl<'a> StructuralEq for Metadata<'a>
[src]
impl<'a> StructuralEq for MetadataBuilder<'a>
[src]
impl<A, B> StructuralEq for EitherOrBoth<A, B>
[src]
impl<T> StructuralEq for FoldWhile<T>
[src]
impl<A> StructuralEq for ExtendedGcd<A>
[src]
impl<T> StructuralEq for Complex<T>
[src]
impl<T> StructuralEq for CachePadded<T>
impl StructuralEq for WaitTimeoutResult
impl StructuralEq for OnceState
impl StructuralEq for ParkToken
impl StructuralEq for RequeueOp
impl StructuralEq for FilterOp
impl StructuralEq for UnparkToken
impl StructuralEq for ParkResult
impl StructuralEq for UnparkResult
impl StructuralEq for WriteStyle
[src]
impl StructuralEq for Color
[src]
impl StructuralEq for Target
[src]
impl StructuralEq for ParseColorError
impl StructuralEq for Color
impl StructuralEq for ColorChoice
impl StructuralEq for ColorSpec
impl StructuralEq for Intense
impl StructuralEq for Color
impl StructuralEq for Timestamp
impl StructuralEq for Duration
impl<'t> StructuralEq for Match<'t>
impl<'t> StructuralEq for Match<'t>
impl StructuralEq for MatchKind
impl StructuralEq for MatchKind
impl StructuralEq for Match
impl StructuralEq for Error
impl StructuralEq for ClassSetItem
impl StructuralEq for AssertionKind
impl StructuralEq for GroupKind
impl StructuralEq for RepetitionKind
impl StructuralEq for ClassUnicodeOpKind
impl StructuralEq for ErrorKind
impl StructuralEq for Flags
impl StructuralEq for ClassUnicodeRange
impl StructuralEq for ClassSetBinaryOpKind
impl StructuralEq for Error
impl StructuralEq for ClassSetBinaryOp
impl StructuralEq for CaptureName
impl StructuralEq for Group
impl StructuralEq for ClassAsciiKind
impl StructuralEq for Comment
impl StructuralEq for ClassBracketed
impl StructuralEq for Utf8Range
impl StructuralEq for Concat
impl StructuralEq for ClassBytesRange
impl StructuralEq for HirKind
impl StructuralEq for Ast
impl StructuralEq for Assertion
impl StructuralEq for ClassUnicode
impl StructuralEq for GroupKind
impl StructuralEq for Flag
impl StructuralEq for ClassBytes
impl StructuralEq for Anchor
impl StructuralEq for LiteralKind
impl StructuralEq for WordBoundary
impl StructuralEq for WithComments
impl StructuralEq for HexLiteralKind
impl StructuralEq for Repetition
impl StructuralEq for Hir
impl StructuralEq for Position
impl StructuralEq for Alternation
impl StructuralEq for FlagsItemKind
impl StructuralEq for Repetition
impl StructuralEq for Class
impl StructuralEq for Group
impl StructuralEq for ClassSet
impl StructuralEq for Error
impl StructuralEq for ClassPerl
impl StructuralEq for Span
impl StructuralEq for Utf8Sequence
impl StructuralEq for Literal
impl StructuralEq for ClassAscii
impl StructuralEq for RepetitionRange
impl StructuralEq for SetFlags
impl StructuralEq for RepetitionOp
impl StructuralEq for RepetitionKind
impl StructuralEq for ClassSetUnion
impl StructuralEq for ClassPerlKind
impl StructuralEq for SpecialLiteralKind
impl StructuralEq for RepetitionRange
impl StructuralEq for ClassUnicodeKind
impl StructuralEq for Class
impl StructuralEq for Literals
impl StructuralEq for ClassUnicode
impl StructuralEq for Literal
impl StructuralEq for Literal
impl StructuralEq for FlagsItem
impl StructuralEq for ErrorKind
impl StructuralEq for ClassSetRange
impl<T> StructuralEq for TrySendError<T>
impl StructuralEq for SendError
impl StructuralEq for Canceled
Loading content...Implementors
impl StructuralEq for Cost
[src]
impl StructuralEq for DatumType
impl StructuralEq for TDim
impl StructuralEq for Validation
[src]
impl StructuralEq for SearchStep
[src]
impl StructuralEq for BacktraceStatus
[src]
impl StructuralEq for TryReserveError
[src]
impl StructuralEq for VarError
1.0.0[src]
impl StructuralEq for orkhon::prelude::ops::nn::tract_downcast_rs::__std::io::ErrorKind
1.0.0[src]
impl StructuralEq for SeekFrom
1.0.0[src]
impl StructuralEq for IpAddr
1.7.0[src]
impl StructuralEq for Ipv6MulticastScope
[src]
impl StructuralEq for Shutdown
1.0.0[src]
impl StructuralEq for SocketAddr
1.0.0[src]
impl StructuralEq for FpCategory
1.0.0[src]
impl StructuralEq for IntErrorKind
[src]
impl StructuralEq for Ordering
1.0.0[src]
impl StructuralEq for RecvTimeoutError
1.12.0[src]
impl StructuralEq for TryRecvError
1.0.0[src]
impl StructuralEq for SliceOrIndex
[src]
impl StructuralEq for AxisInfo
[src]
impl StructuralEq for Blob
impl StructuralEq for InletId
[src]
impl StructuralEq for OutletId
[src]
impl StructuralEq for Symbol
impl StructuralEq for orkhon::prelude::ops::nn::tract_data::internal::tract_smallvec::alloc::fmt::Error
1.0.0[src]
impl StructuralEq for ParseBoolError
1.0.0[src]
impl StructuralEq for Utf8Error
1.0.0[src]
impl StructuralEq for FromUtf8Error
1.0.0[src]
impl StructuralEq for AllocError
[src]
impl StructuralEq for Layout
1.28.0[src]
impl StructuralEq for LayoutError
1.49.0[src]
impl StructuralEq for TypeId
1.0.0[src]
impl StructuralEq for CpuidResult
1.27.0[src]
impl StructuralEq for CharTryFromError
1.34.0[src]
impl StructuralEq for DecodeUtf16Error
1.9.0[src]
impl StructuralEq for ParseCharError
1.20.0[src]
impl StructuralEq for CString
1.0.0[src]
impl StructuralEq for FromBytesWithNulError
1.10.0[src]
impl StructuralEq for FromVecWithNulError
[src]
impl StructuralEq for IntoStringError
1.7.0[src]
impl StructuralEq for NulError
1.0.0[src]
impl StructuralEq for FileType
1.1.0[src]
impl StructuralEq for Permissions
1.0.0[src]
impl StructuralEq for PhantomPinned
1.33.0[src]
impl StructuralEq for AddrParseError
1.0.0[src]
impl StructuralEq for NonZeroI8
1.34.0[src]
impl StructuralEq for NonZeroI16
1.34.0[src]
impl StructuralEq for NonZeroI32
1.34.0[src]
impl StructuralEq for NonZeroI64
1.34.0[src]
impl StructuralEq for NonZeroI128
1.34.0[src]
impl StructuralEq for NonZeroIsize
1.34.0[src]
impl StructuralEq for NonZeroU8
1.28.0[src]
impl StructuralEq for NonZeroU16
1.28.0[src]
impl StructuralEq for NonZeroU32
1.28.0[src]
impl StructuralEq for NonZeroU64
1.28.0[src]
impl StructuralEq for NonZeroU128
1.28.0[src]
impl StructuralEq for NonZeroUsize
1.28.0[src]
impl StructuralEq for ParseFloatError
1.0.0[src]
impl StructuralEq for ParseIntError
1.0.0[src]
impl StructuralEq for TryFromIntError
1.34.0[src]
impl StructuralEq for RangeFull
1.0.0[src]
impl StructuralEq for NoneError
[src]
impl StructuralEq for StripPrefixError
1.7.0[src]
impl StructuralEq for String
1.0.0[src]
impl StructuralEq for ExitStatus
1.0.0[src]
impl StructuralEq for Output
1.0.0[src]
impl StructuralEq for RecvError
1.0.0[src]
impl StructuralEq for orkhon::prelude::ops::nn::tract_downcast_rs::__std::sync::WaitTimeoutResult
1.5.0[src]
impl StructuralEq for AccessError
1.26.0[src]
impl StructuralEq for ThreadId
1.19.0[src]
impl StructuralEq for orkhon::prelude::ops::nn::tract_downcast_rs::__std::time::Duration
1.3.0[src]
impl StructuralEq for Instant
1.8.0[src]
impl StructuralEq for SystemTime
1.8.0[src]
impl StructuralEq for Packer
impl StructuralEq for Axis
[src]
impl StructuralEq for IxDynImpl
[src]
impl StructuralEq for Slice
[src]
impl<'a> StructuralEq for Component<'a>
1.0.0[src]
impl<'a> StructuralEq for Prefix<'a>
1.0.0[src]
impl<'a> StructuralEq for Location<'a>
1.10.0[src]
impl<'a> StructuralEq for PrefixComponent<'a>
1.0.0[src]
impl<A, B> StructuralEq for orkhon::prelude::ops::nn::tract_itertools::EitherOrBoth<A, B>
[src]
impl<I> StructuralEq for Dim<I> where
I: ?Sized,
[src]
I: ?Sized,
impl<Idx> StructuralEq for Range<Idx>
1.0.0[src]
impl<Idx> StructuralEq for RangeFrom<Idx>
1.0.0[src]
impl<Idx> StructuralEq for RangeInclusive<Idx>
1.26.0[src]
impl<Idx> StructuralEq for RangeTo<Idx>
1.0.0[src]
impl<Idx> StructuralEq for RangeToInclusive<Idx>
1.26.0[src]
impl<L, R> StructuralEq for Either<L, R>
[src]
impl<T> StructuralEq for Bound<T>
1.17.0[src]
impl<T> StructuralEq for Option<T>
1.0.0[src]
impl<T> StructuralEq for orkhon::prelude::ops::nn::tract_downcast_rs::__std::sync::mpsc::TrySendError<T>
1.0.0[src]
impl<T> StructuralEq for Poll<T>
1.36.0[src]
impl<T> StructuralEq for orkhon::prelude::ops::nn::tract_itertools::FoldWhile<T>
[src]
impl<T> StructuralEq for PhantomData<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T> StructuralEq for Reverse<T>
1.19.0[src]
impl<T> StructuralEq for BTreeSet<T>
1.0.0[src]
impl<T> StructuralEq for Cursor<T>
1.0.0[src]
impl<T> StructuralEq for ManuallyDrop<T> where
T: ?Sized,
1.20.0[src]
T: ?Sized,