pub enum AirPattern {
Wildcard,
Int(i64),
Bool(bool),
EnumVariant {
enum_id: EnumId,
variant_index: u32,
},
Bind {
name: Spur,
is_mut: bool,
inner: Option<Box<AirPattern>>,
},
Tuple {
elems: Vec<AirPattern>,
},
Struct {
struct_id: StructId,
fields: Vec<(u32, AirPattern)>,
},
EnumDataVariant {
enum_id: EnumId,
variant_index: u32,
fields: Vec<AirPattern>,
},
EnumStructVariant {
enum_id: EnumId,
variant_index: u32,
fields: Vec<(u32, AirPattern)>,
},
EnumUnitVariant {
enum_id: EnumId,
variant_index: u32,
},
}Expand description
A pattern in a match expression (AIR level - typed).
Recursive shape introduced by ADR-0051. Wildcard, Int, Bool, and
EnumVariant are the flat variants produced by the pre-ADR-0051 sema
path; Bind, Tuple, Struct, EnumDataVariant, EnumStructVariant,
and EnumUnitVariant are the recursive variants produced by the new
lowering. During Phases 1-3 both encodings coexist; Phase 4 drops the
flat EnumVariant.
Variants§
Wildcard
Wildcard pattern _ - matches anything, binds nothing.
Int(i64)
Integer literal pattern (can be positive or negative).
Bool(bool)
Boolean literal pattern.
EnumVariant
Legacy flat enum-variant pattern produced by the pre-ADR-0051 lowering path. Kept for backward compatibility until Phase 4.
Bind
Bind the scrutinee (or its projection) to a local. inner is the
sub-pattern applied to the same value; None is a bare binding,
Some(p) is name @ p (not yet exposed in surface syntax).
Tuple
Tuple dispatch; elems[i] applies to projection i.
Fields
elems: Vec<AirPattern>Struct
Named-struct dispatch. Unlisted fields (from ..) become explicit
Wildcard entries at sema lowering time.
EnumDataVariant
Enum data-variant dispatch. fields[i] applies to positional
field i of the variant.
EnumStructVariant
Enum struct-variant dispatch. Same shape as Struct but tagged by
variant.
EnumUnitVariant
Unit enum variant. Recursive-lowering counterpart of the legacy
EnumVariant.
Implementations§
Trait Implementations§
Source§impl Clone for AirPattern
impl Clone for AirPattern
Source§fn clone(&self) -> AirPattern
fn clone(&self) -> AirPattern
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AirPattern
impl Debug for AirPattern
Source§impl<'de> Deserialize<'de> for AirPattern
impl<'de> Deserialize<'de> for AirPattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for AirPattern
impl Display for AirPattern
Auto Trait Implementations§
impl Freeze for AirPattern
impl RefUnwindSafe for AirPattern
impl Send for AirPattern
impl Sync for AirPattern
impl Unpin for AirPattern
impl UnsafeUnpin for AirPattern
impl UnwindSafe for AirPattern
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].