Enum swc_ecma_ast::TsLit
source · pub enum TsLit {
Number(Number),
Str(Str),
Bool(Bool),
BigInt(BigInt),
Tpl(TsTplLitType),
}
Variants§
Implementations§
source§impl 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 const fn is_big_int(&self) -> bool
pub const 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.
Trait Implementations§
source§impl<'arbitrary> Arbitrary<'arbitrary> for TsLit
impl<'arbitrary> Arbitrary<'arbitrary> for TsLit
source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moresource§impl Archive for TsLit
impl Archive for TsLit
source§impl<'de> Deserialize<'de> for TsLit
impl<'de> Deserialize<'de> for TsLit
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<__D> Deserialize<TsLit, __D> for Archived<TsLit>where
__D: SharedDeserializeRegistry + Fallible + ?Sized,
impl<__D> Deserialize<TsLit, __D> for Archived<TsLit>where __D: SharedDeserializeRegistry + Fallible + ?Sized,
source§impl EqIgnoreSpan for TsLit
impl EqIgnoreSpan for TsLit
fn eq_ignore_span(&self, other: &Self) -> bool
source§impl From<TsTplLitType> for TsLit
impl From<TsTplLitType> for TsLit
source§fn from(v: TsTplLitType) -> Self
fn from(v: TsTplLitType) -> Self
source§impl PartialEq<TsLit> for TsLit
impl PartialEq<TsLit> for TsLit
source§impl<__S> Serialize<__S> for TsLitwhere
__S: Serializer + ScratchSpace + SharedSerializeRegistry + Fallible + ?Sized,
impl<__S> Serialize<__S> for TsLitwhere __S: Serializer + ScratchSpace + SharedSerializeRegistry + Fallible + ?Sized,
impl Eq for TsLit
impl StructuralEq for TsLit
impl StructuralPartialEq for TsLit
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§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere T: Archive,
§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive
, it may be unsized. Read more