pub enum PatternKind {
Ident(Ident),
Array {
elements: Vec<Option<PatternElement>>,
rest: Option<Box<RestElement>>,
},
Object {
properties: Vec<Option<PatternElement>>,
rest: Option<Box<RestElement>>,
},
Assign {
target: Box<Pattern>,
default: Box<Expr>,
},
Member(Box<MemberPattern>),
Rest(Box<Pattern>),
Invalid(Box<Expr>),
}Expand description
Pattern payloads.
Variants§
Ident(Ident)
A binding identifier.
Array
[a, , b, ...rest]
Fields
§
elements: Vec<Option<PatternElement>>Element patterns; None for an elision (,,).
§
rest: Option<Box<RestElement>>Trailing rest element.
Object
{ a, b: c, [k]: d, ...rest }
Fields
§
properties: Vec<Option<PatternElement>>Properties, in source order.
§
rest: Option<Box<RestElement>>Trailing rest element.
Assign
target = default
Member(Box<MemberPattern>)
obj.prop / obj[k] — only valid as an assignment target, never as a
binding pattern.
Rest(Box<Pattern>)
...target — a rest element of a parameter list or pattern.
Invalid(Box<Expr>)
An assignment target that is not assignable (a() = 1). QuickJS rejects
this at run time rather than at parse time, so the compiler has to raise
the error while evaluating the expression.
Trait Implementations§
Source§impl Clone for PatternKind
impl Clone for PatternKind
Source§impl Debug for PatternKind
impl Debug for PatternKind
Source§impl PartialEq for PatternKind
impl PartialEq for PatternKind
impl StructuralPartialEq for PatternKind
Auto Trait Implementations§
impl Forget for PatternKind
impl Freeze for PatternKind
impl Move for PatternKind
impl RefUnwindSafe for PatternKind
impl Send for PatternKind
impl Sync for PatternKind
impl Unpin for PatternKind
impl UnsafeUnpin for PatternKind
impl UnwindSafe for PatternKind
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