Enum swc_ecma_ast::TsLit[][src]

pub enum TsLit {
    Number(Number),
    Str(Str),
    Bool(Bool),
    BigInt(BigInt),
    Tpl(TsTplLitType),
}

Variants

Number(Number)
Str(Str)
Bool(Bool)
BigInt(BigInt)

Implementations

impl TsLit[src]

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

Returns true if self is of variant Number.

pub fn expect_number(self) -> Number where
    Self: Debug
[src]

Unwraps the value, yielding the content of Number.

Panics

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

pub fn number(self) -> Option<Number>[src]

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

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

Returns true if self is of variant Str.

pub fn expect_str(self) -> Str where
    Self: Debug
[src]

Unwraps the value, yielding the content of Str.

Panics

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

pub fn str(self) -> Option<Str>[src]

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

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

Returns true if self is of variant Bool.

pub fn expect_bool(self) -> Bool where
    Self: Debug
[src]

Unwraps the value, yielding the content of Bool.

Panics

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

pub fn bool(self) -> Option<Bool>[src]

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

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

Returns true if self is of variant BigInt.

pub fn expect_big_int(self) -> BigInt where
    Self: Debug
[src]

Unwraps the value, yielding the content of BigInt.

Panics

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

pub fn big_int(self) -> Option<BigInt>[src]

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

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

Returns true if self is of variant Tpl.

pub fn expect_tpl(self) -> TsTplLitType where
    Self: Debug
[src]

Unwraps the value, yielding the content of Tpl.

Panics

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

pub fn tpl(self) -> Option<TsTplLitType>[src]

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

Trait Implementations

impl Clone for TsLit[src]

impl Debug for TsLit[src]

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

impl Eq for TsLit[src]

impl EqIgnoreSpan for TsLit[src]

impl From<BigInt> for TsLit[src]

impl From<Bool> for TsLit[src]

impl From<Number> for TsLit[src]

impl From<Str> for TsLit[src]

impl From<TsTplLitType> for TsLit[src]

impl Hash for TsLit[src]

impl PartialEq<TsLit> for TsLit[src]

impl Serialize for TsLit[src]

impl Spanned for TsLit[src]

impl StructuralEq for TsLit[src]

impl StructuralPartialEq for TsLit[src]

Auto Trait Implementations

impl RefUnwindSafe for TsLit

impl Send for TsLit

impl Sync for TsLit

impl Unpin for TsLit

impl UnwindSafe for TsLit

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.