pub enum ConstructorSet<Cx: PatCx> {
Struct {
empty: bool,
},
Variants {
variants: IndexVec<Cx::VariantIdx, VariantVisibility>,
non_exhaustive: bool,
},
Ref,
Union,
Bool,
Integers {
range_1: IntRange,
range_2: Option<IntRange>,
},
Slice {
array_len: Option<usize>,
subtype_is_empty: bool,
},
Unlistable,
NoConstructors,
}
Expand description
Describes the set of all constructors for a type. For details, in particular about the emptiness of constructors, see the top of the file.
In terms of division of responsibility, ConstructorSet::split
handles all of the
exhaustive_patterns
feature.
Variants§
Struct
The type is a tuple or struct. empty
tracks whether the type is empty.
Variants
This type has the following list of constructors. If variants
is empty and
non_exhaustive
is false, don’t use this; use NoConstructors
instead.
Ref
The type is &T
.
Union
The type is a union.
Bool
Booleans.
Integers
The type is spanned by integer values. The range or ranges give the set of allowed values.
The second range is only useful for char
.
Slice
The type is matched by slices. array_len
is the compile-time length of the array, if
known. If subtype_is_empty
, all constructors are empty except possibly the zero-length
slice []
.
Unlistable
The constructors cannot be listed, and the type cannot be matched exhaustively. E.g. str
,
floats.
NoConstructors
The type has no constructors (not even empty ones). This is !
and empty enums.
Implementations§
source§impl<Cx: PatCx> ConstructorSet<Cx>
impl<Cx: PatCx> ConstructorSet<Cx>
sourcepub fn split<'a>(
&self,
ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
) -> SplitConstructorSet<Cx>where
Cx: 'a,
pub fn split<'a>(
&self,
ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
) -> SplitConstructorSet<Cx>where
Cx: 'a,
This analyzes a column of constructors to 1/ determine which constructors of the type (if
any) are missing; 2/ split constructors to handle non-trivial intersections e.g. on ranges
or slices. This can get subtle; see SplitConstructorSet
for details of this operation
and its invariants.
Trait Implementations§
Auto Trait Implementations§
impl<Cx> DynSend for ConstructorSet<Cx>
impl<Cx> DynSync for ConstructorSet<Cx>
impl<Cx> Freeze for ConstructorSet<Cx>
impl<Cx> RefUnwindSafe for ConstructorSet<Cx>
impl<Cx> Send for ConstructorSet<Cx>
impl<Cx> Sync for ConstructorSet<Cx>
impl<Cx> Unpin for ConstructorSet<Cx>
impl<Cx> UnwindSafe for ConstructorSet<Cx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 128 bytes
Size for each variant:
Struct
: 17 bytesVariants
: 48 bytesRef
: 0 bytesUnion
: 0 bytesBool
: 0 bytesIntegers
: 128 bytesSlice
: 40 bytesUnlistable
: 0 bytesNoConstructors
: 0 bytes