pub enum ConstructorSet<Cx: TypeCx> {
Struct {
empty: bool,
},
Variants {
variants: IdxContainer<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.