pub enum Pat {
Ident(BindingIdent),
Array(ArrayPat),
Rest(RestPat),
Object(ObjectPat),
Assign(AssignPat),
Invalid(Invalid),
Expr(Box<Expr>),
}Variants§
Ident(BindingIdent)
Array(ArrayPat)
Rest(RestPat)
Object(ObjectPat)
Assign(AssignPat)
Invalid(Invalid)
Expr(Box<Expr>)
Only for for-in / for-of loops. This is syntactically valid.
Implementations§
source§impl Pat
impl Pat
sourcepub fn as_ident(&self) -> Option<&BindingIdent>
pub fn as_ident(&self) -> Option<&BindingIdent>
Returns Some if self is a reference of variant Ident, and None otherwise.
sourcepub fn as_mut_ident(&mut self) -> Option<&mut BindingIdent>
pub fn as_mut_ident(&mut self) -> Option<&mut BindingIdent>
Returns Some if self is a mutable reference of variant Ident, and None otherwise.
sourcepub fn expect_ident(self) -> BindingIdentwhere
Self: Debug,
pub fn expect_ident(self) -> BindingIdentwhere
Self: Debug,
sourcepub fn ident(self) -> Option<BindingIdent>
pub fn ident(self) -> Option<BindingIdent>
Returns Some if self is of variant Ident, and None otherwise.
sourcepub fn as_array(&self) -> Option<&ArrayPat>
pub fn as_array(&self) -> Option<&ArrayPat>
Returns Some if self is a reference of variant Array, and None otherwise.
sourcepub fn as_mut_array(&mut self) -> Option<&mut ArrayPat>
pub fn as_mut_array(&mut self) -> Option<&mut ArrayPat>
Returns Some if self is a mutable reference of variant Array, and None otherwise.
sourcepub fn expect_array(self) -> ArrayPatwhere
Self: Debug,
pub fn expect_array(self) -> ArrayPatwhere
Self: Debug,
sourcepub fn array(self) -> Option<ArrayPat>
pub fn array(self) -> Option<ArrayPat>
Returns Some if self is of variant Array, and None otherwise.
sourcepub fn as_rest(&self) -> Option<&RestPat>
pub fn as_rest(&self) -> Option<&RestPat>
Returns Some if self is a reference of variant Rest, and None otherwise.
sourcepub fn as_mut_rest(&mut self) -> Option<&mut RestPat>
pub fn as_mut_rest(&mut self) -> Option<&mut RestPat>
Returns Some if self is a mutable reference of variant Rest, and None otherwise.
sourcepub fn expect_rest(self) -> RestPatwhere
Self: Debug,
pub fn expect_rest(self) -> RestPatwhere
Self: Debug,
sourcepub fn rest(self) -> Option<RestPat>
pub fn rest(self) -> Option<RestPat>
Returns Some if self is of variant Rest, and None otherwise.
sourcepub fn as_object(&self) -> Option<&ObjectPat>
pub fn as_object(&self) -> Option<&ObjectPat>
Returns Some if self is a reference of variant Object, and None otherwise.
sourcepub fn as_mut_object(&mut self) -> Option<&mut ObjectPat>
pub fn as_mut_object(&mut self) -> Option<&mut ObjectPat>
Returns Some if self is a mutable reference of variant Object, and None otherwise.
sourcepub fn expect_object(self) -> ObjectPatwhere
Self: Debug,
pub fn expect_object(self) -> ObjectPatwhere
Self: Debug,
sourcepub fn object(self) -> Option<ObjectPat>
pub fn object(self) -> Option<ObjectPat>
Returns Some if self is of variant Object, and None otherwise.
sourcepub fn as_assign(&self) -> Option<&AssignPat>
pub fn as_assign(&self) -> Option<&AssignPat>
Returns Some if self is a reference of variant Assign, and None otherwise.
sourcepub fn as_mut_assign(&mut self) -> Option<&mut AssignPat>
pub fn as_mut_assign(&mut self) -> Option<&mut AssignPat>
Returns Some if self is a mutable reference of variant Assign, and None otherwise.
sourcepub fn expect_assign(self) -> AssignPatwhere
Self: Debug,
pub fn expect_assign(self) -> AssignPatwhere
Self: Debug,
sourcepub fn assign(self) -> Option<AssignPat>
pub fn assign(self) -> Option<AssignPat>
Returns Some if self is of variant Assign, and None otherwise.
sourcepub const fn is_invalid(&self) -> bool
pub const fn is_invalid(&self) -> bool
Returns true if self is of variant Invalid.
sourcepub fn as_invalid(&self) -> Option<&Invalid>
pub fn as_invalid(&self) -> Option<&Invalid>
Returns Some if self is a reference of variant Invalid, and None otherwise.
sourcepub fn as_mut_invalid(&mut self) -> Option<&mut Invalid>
pub fn as_mut_invalid(&mut self) -> Option<&mut Invalid>
Returns Some if self is a mutable reference of variant Invalid, and None otherwise.
sourcepub fn expect_invalid(self) -> Invalidwhere
Self: Debug,
pub fn expect_invalid(self) -> Invalidwhere
Self: Debug,
sourcepub fn invalid(self) -> Option<Invalid>
pub fn invalid(self) -> Option<Invalid>
Returns Some if self is of variant Invalid, and None otherwise.
sourcepub fn as_expr(&self) -> Option<&Box<Expr>>
pub fn as_expr(&self) -> Option<&Box<Expr>>
Returns Some if self is a reference of variant Expr, and None otherwise.
sourcepub fn as_mut_expr(&mut self) -> Option<&mut Box<Expr>>
pub fn as_mut_expr(&mut self) -> Option<&mut Box<Expr>>
Returns Some if self is a mutable reference of variant Expr, and None otherwise.
sourcepub fn expect_expr(self) -> Box<Expr>where
Self: Debug,
pub fn expect_expr(self) -> Box<Expr>where
Self: Debug,
Trait Implementations§
source§impl<'de> Deserialize<'de> for Pat
impl<'de> Deserialize<'de> for Pat
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl EqIgnoreSpan for Pat
impl EqIgnoreSpan for Pat
fn eq_ignore_span(&self, other: &Self) -> bool
source§impl From<(Atom<JsWordStaticSet>, SyntaxContext)> for Box<Pat>
impl From<(Atom<JsWordStaticSet>, SyntaxContext)> for Box<Pat>
source§impl From<(Atom<JsWordStaticSet>, SyntaxContext)> for Pat
impl From<(Atom<JsWordStaticSet>, SyntaxContext)> for Pat
source§impl From<BindingIdent> for Pat
impl From<BindingIdent> for Pat
source§fn from(v: BindingIdent) -> Self
fn from(v: BindingIdent) -> Self
source§impl From<Pat> for VarDeclOrPat
impl From<Pat> for VarDeclOrPat
source§fn from(src: Pat) -> VarDeclOrPat
fn from(src: Pat) -> VarDeclOrPat
impl Eq for Pat
impl StructuralPartialEq for Pat
Auto Trait Implementations§
impl Freeze for Pat
impl RefUnwindSafe for Pat
impl Send for Pat
impl Sync for Pat
impl Unpin for Pat
impl UnwindSafe for Pat
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
§impl<T> CallHasher for T
impl<T> CallHasher for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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 more