Enum swc_ecma_ast::ModuleItem
source · [−]pub enum ModuleItem {
ModuleDecl(ModuleDecl),
Stmt(Stmt),
}
Variants
ModuleDecl(ModuleDecl)
Stmt(Stmt)
Implementations
sourceimpl ModuleItem
impl ModuleItem
sourcepub fn is_module_decl(&self) -> bool
pub fn is_module_decl(&self) -> bool
Returns true
if self
is of variant ModuleDecl
.
sourcepub fn as_module_decl(&self) -> Option<&ModuleDecl>
pub fn as_module_decl(&self) -> Option<&ModuleDecl>
Returns Some
if self
is a reference of variant ModuleDecl
, and None
otherwise.
sourcepub fn as_mut_module_decl(&mut self) -> Option<&mut ModuleDecl>
pub fn as_mut_module_decl(&mut self) -> Option<&mut ModuleDecl>
Returns Some
if self
is a mutable reference of variant ModuleDecl
, and None
otherwise.
sourcepub fn expect_module_decl(self) -> ModuleDeclwhere
Self: Debug,
pub fn expect_module_decl(self) -> ModuleDeclwhere
Self: Debug,
Unwraps the value, yielding the content of ModuleDecl
.
Panics
Panics if the value is not ModuleDecl
, with a panic message including the content of self
.
sourcepub fn module_decl(self) -> Option<ModuleDecl>
pub fn module_decl(self) -> Option<ModuleDecl>
Returns Some
if self
is of variant ModuleDecl
, and None
otherwise.
sourcepub fn as_stmt(&self) -> Option<&Stmt>
pub fn as_stmt(&self) -> Option<&Stmt>
Returns Some
if self
is a reference of variant Stmt
, and None
otherwise.
sourcepub fn as_mut_stmt(&mut self) -> Option<&mut Stmt>
pub fn as_mut_stmt(&mut self) -> Option<&mut Stmt>
Returns Some
if self
is a mutable reference of variant Stmt
, and None
otherwise.
sourcepub fn expect_stmt(self) -> Stmtwhere
Self: Debug,
pub fn expect_stmt(self) -> Stmtwhere
Self: Debug,
Trait Implementations
sourceimpl Clone for ModuleItem
impl Clone for ModuleItem
sourcefn clone(&self) -> ModuleItem
fn clone(&self) -> ModuleItem
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ModuleItem
impl Debug for ModuleItem
sourceimpl<'de> Deserialize<'de> for ModuleItem
impl<'de> Deserialize<'de> for ModuleItem
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl EqIgnoreSpan for ModuleItem
impl EqIgnoreSpan for ModuleItem
fn eq_ignore_span(&self, other: &Self) -> bool
sourceimpl From<ClassDecl> for ModuleItem
impl From<ClassDecl> for ModuleItem
sourcefn from(src: ClassDecl) -> ModuleItem
fn from(src: ClassDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<FnDecl> for ModuleItem
impl From<FnDecl> for ModuleItem
sourcefn from(src: FnDecl) -> ModuleItem
fn from(src: FnDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<ModuleDecl> for ModuleItem
impl From<ModuleDecl> for ModuleItem
sourcefn from(v: ModuleDecl) -> Self
fn from(v: ModuleDecl) -> Self
Converts to this type from the input type.
sourceimpl From<Stmt> for ModuleItem
impl From<Stmt> for ModuleItem
sourceimpl From<TryStmt> for ModuleItem
impl From<TryStmt> for ModuleItem
sourcefn from(src: TryStmt) -> ModuleItem
fn from(src: TryStmt) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<TsEnumDecl> for ModuleItem
impl From<TsEnumDecl> for ModuleItem
sourcefn from(src: TsEnumDecl) -> ModuleItem
fn from(src: TsEnumDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<TsInterfaceDecl> for ModuleItem
impl From<TsInterfaceDecl> for ModuleItem
sourcefn from(src: TsInterfaceDecl) -> ModuleItem
fn from(src: TsInterfaceDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<TsModuleDecl> for ModuleItem
impl From<TsModuleDecl> for ModuleItem
sourcefn from(src: TsModuleDecl) -> ModuleItem
fn from(src: TsModuleDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<TsTypeAliasDecl> for ModuleItem
impl From<TsTypeAliasDecl> for ModuleItem
sourcefn from(src: TsTypeAliasDecl) -> ModuleItem
fn from(src: TsTypeAliasDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl From<VarDecl> for ModuleItem
impl From<VarDecl> for ModuleItem
sourcefn from(src: VarDecl) -> ModuleItem
fn from(src: VarDecl) -> ModuleItem
Converts to this type from the input type.
sourceimpl Hash for ModuleItem
impl Hash for ModuleItem
sourceimpl PartialEq<ModuleItem> for ModuleItem
impl PartialEq<ModuleItem> for ModuleItem
sourcefn eq(&self, other: &ModuleItem) -> bool
fn eq(&self, other: &ModuleItem) -> bool
sourceimpl Serialize for ModuleItem
impl Serialize for ModuleItem
sourceimpl Spanned for ModuleItem
impl Spanned for ModuleItem
sourceimpl Take for ModuleItem
impl Take for ModuleItem
impl Eq for ModuleItem
impl StructuralEq for ModuleItem
impl StructuralPartialEq for ModuleItem
Auto Trait Implementations
impl RefUnwindSafe for ModuleItem
impl Send for ModuleItem
impl Sync for ModuleItem
impl Unpin for ModuleItem
impl UnwindSafe for ModuleItem
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more