[][src]Enum swc_ecma_ast::Pat

pub enum Pat {
    Ident(Ident),
    Array(ArrayPat),
    Rest(RestPat),
    Object(ObjectPat),
    Assign(AssignPat),
    Invalid(Invalid),
    Expr(Box<Expr>),
}

Variants

Ident(Ident)
Array(ArrayPat)
Rest(RestPat)
Object(ObjectPat)
Assign(AssignPat)
Invalid(Invalid)
Expr(Box<Expr>)

Only for for-in / for-of loops. This is syntatically valid.

Implementations

impl Pat[src]

pub fn is_ident(&self) -> bool[src]

Returns true if self is of variant Ident.

pub fn expect_ident(self) -> Ident where
    Self: Debug
[src]

Unwraps the value, yielding the content of Ident.

Panics

Panics if the value is not Ident, with a panic message including the content of self.

pub fn ident(self) -> Option<Ident>[src]

Returns Some if self is of variant Ident, and None otherwise.

pub fn is_array(&self) -> bool[src]

Returns true if self is of variant Array.

pub fn expect_array(self) -> ArrayPat where
    Self: Debug
[src]

Unwraps the value, yielding the content of Array.

Panics

Panics if the value is not Array, with a panic message including the content of self.

pub fn array(self) -> Option<ArrayPat>[src]

Returns Some if self is of variant Array, and None otherwise.

pub fn is_rest(&self) -> bool[src]

Returns true if self is of variant Rest.

pub fn expect_rest(self) -> RestPat where
    Self: Debug
[src]

Unwraps the value, yielding the content of Rest.

Panics

Panics if the value is not Rest, with a panic message including the content of self.

pub fn rest(self) -> Option<RestPat>[src]

Returns Some if self is of variant Rest, and None otherwise.

pub fn is_object(&self) -> bool[src]

Returns true if self is of variant Object.

pub fn expect_object(self) -> ObjectPat where
    Self: Debug
[src]

Unwraps the value, yielding the content of Object.

Panics

Panics if the value is not Object, with a panic message including the content of self.

pub fn object(self) -> Option<ObjectPat>[src]

Returns Some if self is of variant Object, and None otherwise.

pub fn is_assign(&self) -> bool[src]

Returns true if self is of variant Assign.

pub fn expect_assign(self) -> AssignPat where
    Self: Debug
[src]

Unwraps the value, yielding the content of Assign.

Panics

Panics if the value is not Assign, with a panic message including the content of self.

pub fn assign(self) -> Option<AssignPat>[src]

Returns Some if self is of variant Assign, and None otherwise.

pub fn is_invalid(&self) -> bool[src]

Returns true if self is of variant Invalid.

pub fn expect_invalid(self) -> Invalid where
    Self: Debug
[src]

Unwraps the value, yielding the content of Invalid.

Panics

Panics if the value is not Invalid, with a panic message including the content of self.

pub fn invalid(self) -> Option<Invalid>[src]

Returns Some if self is of variant Invalid, and None otherwise.

pub fn is_expr(&self) -> bool[src]

Returns true if self is of variant Expr.

pub fn expect_expr(self) -> Box<Expr> where
    Self: Debug
[src]

Unwraps the value, yielding the content of Expr.

Panics

Panics if the value is not Expr, with a panic message including the content of self.

pub fn expr(self) -> Option<Box<Expr>>[src]

Returns Some if self is of variant Expr, and None otherwise.

Trait Implementations

impl Clone for Pat[src]

impl Debug for Pat[src]

impl<'de> Deserialize<'de> for Pat[src]

impl Eq for Pat[src]

impl EqIgnoreSpan for Pat[src]

impl From<ArrayPat> for Pat[src]

impl From<AssignPat> for Pat[src]

impl From<Box<Expr, Global>> for Pat[src]

impl From<Ident> for Pat[src]

impl From<Invalid> for Pat[src]

impl From<ObjectPat> for Pat[src]

impl From<Pat> for VarDeclOrPat[src]

impl From<RestPat> for Pat[src]

impl Hash for Pat[src]

impl PartialEq<Pat> for Pat[src]

impl Serialize for Pat[src]

impl Spanned for Pat[src]

impl StructuralEq for Pat[src]

impl StructuralPartialEq for Pat[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Send for T where
    T: ?Sized
[src]

impl<T> Sync for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.