Struct valkyrie_ast::ClassPatternNode
source · pub struct ClassPatternNode {
pub bind: Option<IdentifierNode>,
pub name: Option<NamePathNode>,
pub terms: Vec<PatternNode>,
pub span: Range<u32>,
}
Expand description
a := Named { a: b, c: d }
match term {
case bind@module::Name {ref a, mut b, c} if a > 0:
body()
}
let bind = term;
# Option<(?, ?, ?)>
let unapply = module::Name::extract(bind);
if unapply.is_none() {
break;
}
# (?, ?, ?)
let bind = unapply!;
let a = unapply!.0;
let b = unapply!.1;
let c = unapply!.2;
Fields§
§bind: Option<IdentifierNode>
bind <- ...
name: Option<NamePathNode>
case namespace::Name()
terms: Vec<PatternNode>
case (ref a, mut b)
span: Range<u32>
The range of the node
Trait Implementations§
source§impl Clone for ClassPatternNode
impl Clone for ClassPatternNode
source§fn clone(&self) -> ClassPatternNode
fn clone(&self) -> ClassPatternNode
Returns a copy 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 moresource§impl Debug for ClassPatternNode
impl Debug for ClassPatternNode
source§impl From<ClassPatternNode> for PatternNode
impl From<ClassPatternNode> for PatternNode
source§fn from(o: ClassPatternNode) -> Self
fn from(o: ClassPatternNode) -> Self
Converts to this type from the input type.
source§impl Hash for ClassPatternNode
impl Hash for ClassPatternNode
source§impl PartialEq for ClassPatternNode
impl PartialEq for ClassPatternNode
source§fn eq(&self, other: &ClassPatternNode) -> bool
fn eq(&self, other: &ClassPatternNode) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ClassPatternNode
impl StructuralPartialEq for ClassPatternNode
Auto Trait Implementations§
impl RefUnwindSafe for ClassPatternNode
impl Send for ClassPatternNode
impl Sync for ClassPatternNode
impl Unpin for ClassPatternNode
impl UnwindSafe for ClassPatternNode
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