pub enum RirPattern {
Wildcard(Span),
Int(i64, Span),
Bool(bool, Span),
Path {
module: Option<InstRef>,
type_name: Spur,
variant: Spur,
span: Span,
},
DataVariant {
module: Option<InstRef>,
type_name: Spur,
variant: Spur,
bindings: Vec<RirPatternBinding>,
span: Span,
},
StructVariant {
module: Option<InstRef>,
type_name: Spur,
variant: Spur,
field_bindings: Vec<RirStructPatternBinding>,
span: Span,
},
}Expand description
A pattern in a match expression (RIR level - untyped).
Variants§
Wildcard(Span)
Wildcard pattern _ - matches anything
Int(i64, Span)
Integer literal pattern (can be positive or negative)
Bool(bool, Span)
Boolean literal pattern
Path
Path pattern for enum variants (e.g., Color::Red or module.Color::Red)
Fields
§
module: Option<InstRef>Optional module reference for qualified paths (e.g., the module in module.Color::Red)
§
type_name: SpurThe enum type name
§
variant: SpurThe variant name
DataVariant
Data variant pattern with field bindings (e.g., Option::Some(x))
Fields
§
type_name: SpurThe enum type name
§
variant: SpurThe variant name
§
bindings: Vec<RirPatternBinding>Bindings for each field
StructVariant
Struct variant pattern with named field bindings (e.g., Shape::Circle { radius })
Implementations§
Trait Implementations§
Source§impl Clone for RirPattern
impl Clone for RirPattern
Source§fn clone(&self) -> RirPattern
fn clone(&self) -> RirPattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RirPattern
impl RefUnwindSafe for RirPattern
impl Send for RirPattern
impl Sync for RirPattern
impl Unpin for RirPattern
impl UnwindSafe for RirPattern
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§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,
Convert an item of the sequence into a [
MaybeRef].