pub enum Pat {
Show 17 variants
None,
Discard,
Unit,
Bind(Sym),
At(Sym, PatId),
Equal(NodeId),
Less(NodeId),
Greater(NodeId),
TypeKind(TyKind, PatId),
TypeRef(NodeId, PatId),
Unwrap {
depth: u32,
inner: PatId,
},
Or(PatId, PatId),
List {
len: u32,
elems: PatId,
rest: PatId,
},
Map {
len: u32,
entries: PatId,
rest: PatId,
},
Lookup(NodeId),
When {
inner: PatId,
gpat: PatId,
cond: NodeId,
},
Barrier {
run: Run,
len: u32,
},
}Expand description
A pattern, 16 bytes like Node.
Variants§
None
The slot of a block clause that binds nothing.
Discard
Unit
Bind(Sym)
At(Sym, PatId)
Equal(NodeId)
Less(NodeId)
Greater(NodeId)
TypeKind(TyKind, PatId)
<pat> as <Kind>, a builtin prototype.
TypeRef(NodeId, PatId)
<pat> as <Proto>, any other prototype, evaluated at match time.
Unwrap
Or(PatId, PatId)
List
rest is PatId::NONE for an exact-length list.
Map
The run is the len key patterns, then the len value patterns. A key
is a Lookup or a pattern that captures the key.
Lookup(NodeId)
A map pattern’s looked-up key.
When
gpat is PatId::NONE for a plain guard.
Barrier
Stands before a run in debug builds.
Trait Implementations§
impl Copy for Pat
impl Eq for Pat
impl StructuralPartialEq for Pat
Auto Trait Implementations§
impl Freeze for Pat
impl RefUnwindSafe for Pat
impl Send for Pat
impl Sync for Pat
impl Unpin for Pat
impl UnsafeUnpin for Pat
impl UnwindSafe for Pat
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more