Enum swc_ecma_ast::Decl
source · [−]pub enum Decl {
Class(ClassDecl),
Fn(FnDecl),
Var(Box<VarDecl>),
TsInterface(Box<TsInterfaceDecl>),
TsTypeAlias(Box<TsTypeAliasDecl>),
TsEnum(Box<TsEnumDecl>),
TsModule(Box<TsModuleDecl>),
}
Variants
Class(ClassDecl)
Fn(FnDecl)
Var(Box<VarDecl>)
TsInterface(Box<TsInterfaceDecl>)
TsTypeAlias(Box<TsTypeAliasDecl>)
TsEnum(Box<TsEnumDecl>)
TsModule(Box<TsModuleDecl>)
Implementations
sourceimpl Decl
impl Decl
sourcepub fn as_class(&self) -> Option<&ClassDecl>
pub fn as_class(&self) -> Option<&ClassDecl>
Returns Some
if self
is a reference of variant Class
, and None
otherwise.
sourcepub fn as_mut_class(&mut self) -> Option<&mut ClassDecl>
pub fn as_mut_class(&mut self) -> Option<&mut ClassDecl>
Returns Some
if self
is a mutable reference of variant Class
, and None
otherwise.
sourcepub fn expect_class(self) -> ClassDeclwhere
Self: Debug,
pub fn expect_class(self) -> ClassDeclwhere
Self: Debug,
sourcepub fn class(self) -> Option<ClassDecl>
pub fn class(self) -> Option<ClassDecl>
Returns Some
if self
is of variant Class
, and None
otherwise.
sourcepub fn is_fn_decl(&self) -> bool
pub fn is_fn_decl(&self) -> bool
Returns true
if self
is of variant Fn
.
sourcepub fn as_fn_decl(&self) -> Option<&FnDecl>
pub fn as_fn_decl(&self) -> Option<&FnDecl>
Returns Some
if self
is a reference of variant Fn
, and None
otherwise.
sourcepub fn as_mut_fn_decl(&mut self) -> Option<&mut FnDecl>
pub fn as_mut_fn_decl(&mut self) -> Option<&mut FnDecl>
Returns Some
if self
is a mutable reference of variant Fn
, and None
otherwise.
sourcepub fn expect_fn_decl(self) -> FnDeclwhere
Self: Debug,
pub fn expect_fn_decl(self) -> FnDeclwhere
Self: Debug,
sourcepub fn fn_decl(self) -> Option<FnDecl>
pub fn fn_decl(self) -> Option<FnDecl>
Returns Some
if self
is of variant Fn
, and None
otherwise.
sourcepub fn as_var(&self) -> Option<&Box<VarDecl>>
pub fn as_var(&self) -> Option<&Box<VarDecl>>
Returns Some
if self
is a reference of variant Var
, and None
otherwise.
sourcepub fn as_mut_var(&mut self) -> Option<&mut Box<VarDecl>>
pub fn as_mut_var(&mut self) -> Option<&mut Box<VarDecl>>
Returns Some
if self
is a mutable reference of variant Var
, and None
otherwise.
sourcepub fn expect_var(self) -> Box<VarDecl>where
Self: Debug,
pub fn expect_var(self) -> Box<VarDecl>where
Self: Debug,
sourcepub fn var(self) -> Option<Box<VarDecl>>
pub fn var(self) -> Option<Box<VarDecl>>
Returns Some
if self
is of variant Var
, and None
otherwise.
sourcepub fn is_ts_interface(&self) -> bool
pub fn is_ts_interface(&self) -> bool
Returns true
if self
is of variant TsInterface
.
sourcepub fn as_ts_interface(&self) -> Option<&Box<TsInterfaceDecl>>
pub fn as_ts_interface(&self) -> Option<&Box<TsInterfaceDecl>>
Returns Some
if self
is a reference of variant TsInterface
, and None
otherwise.
sourcepub fn as_mut_ts_interface(&mut self) -> Option<&mut Box<TsInterfaceDecl>>
pub fn as_mut_ts_interface(&mut self) -> Option<&mut Box<TsInterfaceDecl>>
Returns Some
if self
is a mutable reference of variant TsInterface
, and None
otherwise.
sourcepub fn expect_ts_interface(self) -> Box<TsInterfaceDecl>where
Self: Debug,
pub fn expect_ts_interface(self) -> Box<TsInterfaceDecl>where
Self: Debug,
Unwraps the value, yielding the content of TsInterface
.
Panics
Panics if the value is not TsInterface
, with a panic message including the content of self
.
sourcepub fn ts_interface(self) -> Option<Box<TsInterfaceDecl>>
pub fn ts_interface(self) -> Option<Box<TsInterfaceDecl>>
Returns Some
if self
is of variant TsInterface
, and None
otherwise.
sourcepub fn is_ts_type_alias(&self) -> bool
pub fn is_ts_type_alias(&self) -> bool
Returns true
if self
is of variant TsTypeAlias
.
sourcepub fn as_ts_type_alias(&self) -> Option<&Box<TsTypeAliasDecl>>
pub fn as_ts_type_alias(&self) -> Option<&Box<TsTypeAliasDecl>>
Returns Some
if self
is a reference of variant TsTypeAlias
, and None
otherwise.
sourcepub fn as_mut_ts_type_alias(&mut self) -> Option<&mut Box<TsTypeAliasDecl>>
pub fn as_mut_ts_type_alias(&mut self) -> Option<&mut Box<TsTypeAliasDecl>>
Returns Some
if self
is a mutable reference of variant TsTypeAlias
, and None
otherwise.
sourcepub fn expect_ts_type_alias(self) -> Box<TsTypeAliasDecl>where
Self: Debug,
pub fn expect_ts_type_alias(self) -> Box<TsTypeAliasDecl>where
Self: Debug,
Unwraps the value, yielding the content of TsTypeAlias
.
Panics
Panics if the value is not TsTypeAlias
, with a panic message including the content of self
.
sourcepub fn ts_type_alias(self) -> Option<Box<TsTypeAliasDecl>>
pub fn ts_type_alias(self) -> Option<Box<TsTypeAliasDecl>>
Returns Some
if self
is of variant TsTypeAlias
, and None
otherwise.
sourcepub fn is_ts_enum(&self) -> bool
pub fn is_ts_enum(&self) -> bool
Returns true
if self
is of variant TsEnum
.
sourcepub fn as_ts_enum(&self) -> Option<&Box<TsEnumDecl>>
pub fn as_ts_enum(&self) -> Option<&Box<TsEnumDecl>>
Returns Some
if self
is a reference of variant TsEnum
, and None
otherwise.
sourcepub fn as_mut_ts_enum(&mut self) -> Option<&mut Box<TsEnumDecl>>
pub fn as_mut_ts_enum(&mut self) -> Option<&mut Box<TsEnumDecl>>
Returns Some
if self
is a mutable reference of variant TsEnum
, and None
otherwise.
sourcepub fn expect_ts_enum(self) -> Box<TsEnumDecl>where
Self: Debug,
pub fn expect_ts_enum(self) -> Box<TsEnumDecl>where
Self: Debug,
sourcepub fn ts_enum(self) -> Option<Box<TsEnumDecl>>
pub fn ts_enum(self) -> Option<Box<TsEnumDecl>>
Returns Some
if self
is of variant TsEnum
, and None
otherwise.
sourcepub fn is_ts_module(&self) -> bool
pub fn is_ts_module(&self) -> bool
Returns true
if self
is of variant TsModule
.
sourcepub fn as_ts_module(&self) -> Option<&Box<TsModuleDecl>>
pub fn as_ts_module(&self) -> Option<&Box<TsModuleDecl>>
Returns Some
if self
is a reference of variant TsModule
, and None
otherwise.
sourcepub fn as_mut_ts_module(&mut self) -> Option<&mut Box<TsModuleDecl>>
pub fn as_mut_ts_module(&mut self) -> Option<&mut Box<TsModuleDecl>>
Returns Some
if self
is a mutable reference of variant TsModule
, and None
otherwise.