Enum swc_ecma_ast::Pat
source · [−]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
sourceimpl 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 fn is_invalid(&self) -> bool
pub 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.