Enum swc_ecma_ast::PropName
source · [−]pub enum PropName {
Ident(Ident),
Str(Str),
Num(Number),
Computed(ComputedPropName),
BigInt(BigInt),
}
Variants
Ident(Ident)
Str(Str)
String literal.
Num(Number)
Numeric literal.
Computed(ComputedPropName)
BigInt(BigInt)
Implementations
sourceimpl PropName
impl PropName
sourcepub fn as_ident(&self) -> Option<&Ident>
pub fn as_ident(&self) -> Option<&Ident>
Returns Some
if self
is a reference of variant Ident
, and None
otherwise.
sourcepub fn as_mut_ident(&mut self) -> Option<&mut Ident>
pub fn as_mut_ident(&mut self) -> Option<&mut Ident>
Returns Some
if self
is a mutable reference of variant Ident
, and None
otherwise.
sourcepub fn expect_ident(self) -> Identwhere
Self: Debug,
pub fn expect_ident(self) -> Identwhere
Self: Debug,
sourcepub fn ident(self) -> Option<Ident>
pub fn ident(self) -> Option<Ident>
Returns Some
if self
is of variant Ident
, 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_num(&self) -> Option<&Number>
pub fn as_num(&self) -> Option<&Number>
Returns Some
if self
is a reference of variant Num
, and None
otherwise.
sourcepub fn as_mut_num(&mut self) -> Option<&mut Number>
pub fn as_mut_num(&mut self) -> Option<&mut Number>
Returns Some
if self
is a mutable reference of variant Num
, and None
otherwise.
sourcepub fn expect_num(self) -> Numberwhere
Self: Debug,
pub fn expect_num(self) -> Numberwhere
Self: Debug,
sourcepub fn is_computed(&self) -> bool
pub fn is_computed(&self) -> bool
Returns true
if self
is of variant Computed
.
sourcepub fn as_computed(&self) -> Option<&ComputedPropName>
pub fn as_computed(&self) -> Option<&ComputedPropName>
Returns Some
if self
is a reference of variant Computed
, and None
otherwise.
sourcepub fn as_mut_computed(&mut self) -> Option<&mut ComputedPropName>
pub fn as_mut_computed(&mut self) -> Option<&mut ComputedPropName>
Returns Some
if self
is a mutable reference of variant Computed
, and None
otherwise.
sourcepub fn expect_computed(self) -> ComputedPropNamewhere
Self: Debug,
pub fn expect_computed(self) -> ComputedPropNamewhere
Self: Debug,
sourcepub fn computed(self) -> Option<ComputedPropName>
pub fn computed(self) -> Option<ComputedPropName>
Returns Some
if self
is of variant Computed
, and None
otherwise.
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.