pub enum ObjectPatternElement {
SingleName {
name: PropertyName,
ident: Identifier,
default_init: Option<Expression>,
},
RestProperty {
ident: Identifier,
},
AssignmentPropertyAccess {
name: PropertyName,
access: PropertyAccess,
default_init: Option<Expression>,
},
AssignmentRestPropertyAccess {
access: PropertyAccess,
},
Pattern {
name: PropertyName,
pattern: Pattern,
default_init: Option<Expression>,
},
}Expand description
The different types of bindings that an ObjectPattern may contain.
Corresponds to the BindingProperty and the AssignmentProperty nodes.
Variants§
SingleName
SingleName represents one of the following properties:
SingleNamewith an identifier and an optional default initializer.BindingPropertywith an property name and aSingleNameBindingas theBindingElement.
More information:
Fields
name: PropertyNameThe identifier name of the property to be destructured.
ident: IdentifierThe variable name where the property value will be stored.
default_init: Option<Expression>An optional default value for the variable, in case the property doesn’t exist.
RestProperty
RestProperty represents a BindingRestProperty with an identifier.
It also includes a list of the property keys that should be excluded from the rest, because they where already assigned.
More information:
Fields
ident: IdentifierThe variable name where the unassigned properties will be stored.
AssignmentPropertyAccess
AssignmentGetField represents an AssignmentProperty with an expression field member expression AssignmentElement.
Note: According to the spec this is not part of an ObjectBindingPattern.
This is only used when a object literal is used to cover an AssignmentPattern.
More information:
Fields
name: PropertyNameThe identifier name of the property to be destructured.
access: PropertyAccessThe property access where the property value will be destructured.
default_init: Option<Expression>An optional default value for the variable, in case the property doesn’t exist.
AssignmentRestPropertyAccess
AssignmentRestProperty represents a rest property with a DestructuringAssignmentTarget.
Note: According to the spec this is not part of an ObjectBindingPattern.
This is only used when a object literal is used to cover an AssignmentPattern.
More information:
Fields
access: PropertyAccessThe property access where the unassigned properties will be stored.
Pattern
Pattern represents a property with a Pattern as the element.
Additionally to the identifier of the new property and the nested pattern, this may also include an optional default initializer.
More information:
Fields
name: PropertyNameThe identifier name of the property to be destructured.
default_init: Option<Expression>An optional default value for the variable, in case the property doesn’t exist.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for ObjectPatternElement
impl<'arbitrary> Arbitrary<'arbitrary> for ObjectPatternElement
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for ObjectPatternElement
impl Clone for ObjectPatternElement
Source§fn clone(&self) -> ObjectPatternElement
fn clone(&self) -> ObjectPatternElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more