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 PatternKindwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Option<PatternElement>>: Freeze,
*const RestElement is !null: Freeze,
PhantomData<RestElement>: Freeze,
*const Pattern is !null: Freeze,
PhantomData<Pattern>: Freeze,
*const Expr is !null: Freeze,
PhantomData<Expr>: Freeze,
*const MemberPattern is !null: Freeze,
PhantomData<MemberPattern>: Freeze,
impl Move for PatternKind
impl RefUnwindSafe for PatternKind
impl Send for PatternKindwhere
RawVecInner: Send,
BoxRaw<Expr>: Send,
BoxRaw<RestElement>: Send,
BoxRaw<Pattern>: Send,
BoxRaw<MemberPattern>: Send,
impl Sync for PatternKindwhere
RawVecInner: Sync,
BoxRaw<Expr>: Sync,
BoxRaw<RestElement>: Sync,
BoxRaw<Pattern>: Sync,
BoxRaw<MemberPattern>: Sync,
impl Unpin for PatternKind
impl UnsafeUnpin for PatternKindwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Option<PatternElement>>: UnsafeUnpin,
*const RestElement is !null: UnsafeUnpin,
PhantomData<RestElement>: UnsafeUnpin,
*const Pattern is !null: UnsafeUnpin,
PhantomData<Pattern>: UnsafeUnpin,
*const Expr is !null: UnsafeUnpin,
PhantomData<Expr>: UnsafeUnpin,
*const MemberPattern is !null: UnsafeUnpin,
PhantomData<MemberPattern>: UnsafeUnpin,
impl UnwindSafe for PatternKindwhere
RawVecInner: UnwindSafe,
BoxRaw<Expr>: UnwindSafe,
BoxRaw<RestElement>: UnwindSafe,
BoxRaw<Pattern>: UnwindSafe,
BoxRaw<MemberPattern>: UnwindSafe,
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