pub enum PatternKind {
Identifier(Identifier),
Array {
elements: Vec<Option<Pattern>>,
},
Object {
properties: Vec<ObjectPatternMember>,
},
Rest {
argument: Box<Pattern>,
},
Assignment {
left: Box<Pattern>,
right: Box<Expression>,
},
}Expand description
The shape of an ECMAScript binding pattern.
Variants§
Identifier(Identifier)
A plain identifier binding (let x = ...).
Array
An array-destructuring pattern (let [a, , b, ...rest] = ...).
None entries are holes; the final entry may be a Rest variant.
Object
An object-destructuring pattern (let { a, b: c, ...rest } = ...).
Fields
§
properties: Vec<ObjectPatternMember>Properties and an optional final rest element.
Rest
A rest element used inside PatternKind::Array or as the final
formal parameter (...args).
Assignment
A pattern with a default value, used in destructuring or as a default
formal parameter ({ a = 1 }, (x = 0) =>).
Trait Implementations§
Source§impl Clone for PatternKind
impl Clone for PatternKind
Source§fn clone(&self) -> PatternKind
fn clone(&self) -> PatternKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PatternKind
impl Debug for PatternKind
Source§impl Display for PatternKind
impl Display for PatternKind
impl Eq for PatternKind
Source§impl PartialEq for PatternKind
impl PartialEq for PatternKind
impl StructuralPartialEq for PatternKind
Auto Trait Implementations§
impl Freeze 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