Enum swc_ecma_ast::TsLit
source · [−]pub enum TsLit {
Number(Number),
Str(Str),
Bool(Bool),
BigInt(BigInt),
Tpl(TsTplLitType),
}
Variants
Number(Number)
Str(Str)
Bool(Bool)
BigInt(BigInt)
Tpl(TsTplLitType)
Implementations
sourceimpl TsLit
impl TsLit
sourcepub fn as_number(&self) -> Option<&Number>
pub fn as_number(&self) -> Option<&Number>
Returns Some
if self
is a reference of variant Number
, and None
otherwise.
sourcepub fn as_mut_number(&mut self) -> Option<&mut Number>
pub fn as_mut_number(&mut self) -> Option<&mut Number>
Returns Some
if self
is a mutable reference of variant Number
, and None
otherwise.
sourcepub fn expect_number(self) -> Numberwhere
Self: Debug,
pub fn expect_number(self) -> Numberwhere
Self: Debug,
sourcepub fn number(self) -> Option<Number>
pub fn number(self) -> Option<Number>
Returns Some
if self
is of variant Number
, and None
otherwise.
sourcepub fn as_str(&self) -> Option<&Str>
pub fn as_str(&self) -> Option<&Str>
Returns Some
if self
is a reference of variant Str
, and None
otherwise.
sourcepub fn as_mut_str(&mut self) -> Option<&mut Str>
pub fn as_mut_str(&mut self) -> Option<&mut Str>
Returns Some
if self
is a mutable reference of variant Str
, and None
otherwise.
sourcepub fn expect_str(self) -> Strwhere
Self: Debug,
pub fn expect_str(self) -> Strwhere
Self: Debug,
sourcepub fn as_bool(&self) -> Option<&Bool>
pub fn as_bool(&self) -> Option<&Bool>
Returns Some
if self
is a reference of variant Bool
, and None
otherwise.
sourcepub fn as_mut_bool(&mut self) -> Option<&mut Bool>
pub fn as_mut_bool(&mut self) -> Option<&mut Bool>
Returns Some
if self
is a mutable reference of variant Bool
, and None
otherwise.
sourcepub fn expect_bool(self) -> Boolwhere
Self: Debug,
pub fn expect_bool(self) -> Boolwhere
Self: Debug,
sourcepub fn is_big_int(&self) -> bool
pub fn is_big_int(&self) -> bool
Returns true
if self
is of variant BigInt
.
sourcepub fn as_big_int(&self) -> Option<&BigInt>
pub fn as_big_int(&self) -> Option<&BigInt>
Returns Some
if self
is a reference of variant BigInt
, and None
otherwise.
sourcepub fn as_mut_big_int(&mut self) -> Option<&mut BigInt>
pub fn as_mut_big_int(&mut self) -> Option<&mut BigInt>
Returns Some
if self
is a mutable reference of variant BigInt
, and None
otherwise.
sourcepub fn expect_big_int(self) -> BigIntwhere
Self: Debug,
pub fn expect_big_int(self) -> BigIntwhere
Self: Debug,
sourcepub fn big_int(self) -> Option<BigInt>
pub fn big_int(self) -> Option<BigInt>
Returns Some
if self
is of variant BigInt
, and None
otherwise.
sourcepub fn as_tpl(&self) -> Option<&TsTplLitType>
pub fn as_tpl(&self) -> Option<&TsTplLitType>
Returns Some
if self
is a reference of variant Tpl
, and None
otherwise.
sourcepub fn as_mut_tpl(&mut self) -> Option<&mut TsTplLitType>
pub fn as_mut_tpl(&mut self) -> Option<&mut TsTplLitType>
Returns Some
if self
is a mutable reference of variant Tpl
, and None
otherwise.
sourcepub fn expect_tpl(self) -> TsTplLitTypewhere
Self: Debug,
pub fn expect_tpl(self) -> TsTplLitTypewhere
Self: Debug,
sourcepub fn tpl(self) -> Option<TsTplLitType>
pub fn tpl(self) -> Option<TsTplLitType>
Returns Some
if self
is of variant Tpl
, and None
otherwise.