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 Clone for ObjectPatternElement
impl Clone for ObjectPatternElement
Source§fn clone(&self) -> ObjectPatternElement
fn clone(&self) -> ObjectPatternElement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ObjectPatternElement
impl Debug for ObjectPatternElement
Source§impl<'de> Deserialize<'de> for ObjectPatternElement
impl<'de> Deserialize<'de> for ObjectPatternElement
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectPatternElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectPatternElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<&'a ObjectPatternElement> for NodeRef<'a>
impl<'a> From<&'a ObjectPatternElement> for NodeRef<'a>
Source§fn from(node: &'a ObjectPatternElement) -> NodeRef<'a>
fn from(node: &'a ObjectPatternElement) -> NodeRef<'a>
Source§impl<'a> From<&'a mut ObjectPatternElement> for NodeRefMut<'a>
impl<'a> From<&'a mut ObjectPatternElement> for NodeRefMut<'a>
Source§fn from(node: &'a mut ObjectPatternElement) -> NodeRefMut<'a>
fn from(node: &'a mut ObjectPatternElement) -> NodeRefMut<'a>
Source§impl PartialEq for ObjectPatternElement
impl PartialEq for ObjectPatternElement
Source§impl Serialize for ObjectPatternElement
impl Serialize for ObjectPatternElement
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl ToInternedString for ObjectPatternElement
impl ToInternedString for ObjectPatternElement
Source§fn to_interned_string(&self, interner: &Interner) -> String
fn to_interned_string(&self, interner: &Interner) -> String
Source§impl VisitWith for ObjectPatternElement
impl VisitWith for ObjectPatternElement
Source§fn visit_with<'a, V>(
&'a self,
visitor: &mut V,
) -> ControlFlow<<V as Visitor<'a>>::BreakTy>where
V: Visitor<'a>,
fn visit_with<'a, V>(
&'a self,
visitor: &mut V,
) -> ControlFlow<<V as Visitor<'a>>::BreakTy>where
V: Visitor<'a>,
Source§fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<<V as VisitorMut<'a>>::BreakTy>where
V: VisitorMut<'a>,
fn visit_with_mut<'a, V>(
&'a mut self,
visitor: &mut V,
) -> ControlFlow<<V as VisitorMut<'a>>::BreakTy>where
V: VisitorMut<'a>,
impl StructuralPartialEq for ObjectPatternElement
Auto Trait Implementations§
impl Freeze for ObjectPatternElement
impl !RefUnwindSafe for ObjectPatternElement
impl !Send for ObjectPatternElement
impl !Sync for ObjectPatternElement
impl Unpin for ObjectPatternElement
impl !UnwindSafe for ObjectPatternElement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.