pub struct TsStmt(pub Stmt);Expand description
Wrapper for swc_core::ecma::ast::Stmt that implements [Display].
This allows statements to be interpolated into string-based templates.
§Example
use macroforge_ts_syn::TsStmt;
let stmt: Stmt = /* ... */;
let wrapped = TsStmt(stmt);
println!("{}", wrapped); // Emits the statementTuple Fields§
§0: StmtMethods from Deref<Target = Stmt>§
Sourcepub fn as_block(&self) -> Option<&BlockStmt>
pub fn as_block(&self) -> Option<&BlockStmt>
Returns Some if self is a reference of variant Block, and None otherwise.
Sourcepub fn as_empty(&self) -> Option<&EmptyStmt>
pub fn as_empty(&self) -> Option<&EmptyStmt>
Returns Some if self is a reference of variant Empty, and None otherwise.
Sourcepub fn is_debugger(&self) -> bool
pub fn is_debugger(&self) -> bool
Returns true if self is of variant Debugger.
Sourcepub fn as_debugger(&self) -> Option<&DebuggerStmt>
pub fn as_debugger(&self) -> Option<&DebuggerStmt>
Returns Some if self is a reference of variant Debugger, and None otherwise.
Sourcepub fn as_with(&self) -> Option<&WithStmt>
pub fn as_with(&self) -> Option<&WithStmt>
Returns Some if self is a reference of variant With, and None otherwise.
Sourcepub fn is_return_stmt(&self) -> bool
pub fn is_return_stmt(&self) -> bool
Returns true if self is of variant Return.
Sourcepub fn as_return_stmt(&self) -> Option<&ReturnStmt>
pub fn as_return_stmt(&self) -> Option<&ReturnStmt>
Returns Some if self is a reference of variant Return, and None otherwise.
Sourcepub fn is_labeled(&self) -> bool
pub fn is_labeled(&self) -> bool
Returns true if self is of variant Labeled.
Sourcepub fn as_labeled(&self) -> Option<&LabeledStmt>
pub fn as_labeled(&self) -> Option<&LabeledStmt>
Returns Some if self is a reference of variant Labeled, and None otherwise.
Sourcepub fn is_break_stmt(&self) -> bool
pub fn is_break_stmt(&self) -> bool
Returns true if self is of variant Break.
Sourcepub fn as_break_stmt(&self) -> Option<&BreakStmt>
pub fn as_break_stmt(&self) -> Option<&BreakStmt>
Returns Some if self is a reference of variant Break, and None otherwise.
Sourcepub fn is_continue_stmt(&self) -> bool
pub fn is_continue_stmt(&self) -> bool
Returns true if self is of variant Continue.
Sourcepub fn as_continue_stmt(&self) -> Option<&ContinueStmt>
pub fn as_continue_stmt(&self) -> Option<&ContinueStmt>
Returns Some if self is a reference of variant Continue, and None otherwise.
Sourcepub fn is_if_stmt(&self) -> bool
pub fn is_if_stmt(&self) -> bool
Returns true if self is of variant If.
Sourcepub fn as_if_stmt(&self) -> Option<&IfStmt>
pub fn as_if_stmt(&self) -> Option<&IfStmt>
Returns Some if self is a reference of variant If, and None otherwise.
Sourcepub fn as_switch(&self) -> Option<&SwitchStmt>
pub fn as_switch(&self) -> Option<&SwitchStmt>
Returns Some if self is a reference of variant Switch, and None otherwise.
Sourcepub fn as_throw(&self) -> Option<&ThrowStmt>
pub fn as_throw(&self) -> Option<&ThrowStmt>
Returns Some if self is a reference of variant Throw, and None otherwise.
Sourcepub fn is_try_stmt(&self) -> bool
pub fn is_try_stmt(&self) -> bool
Returns true if self is of variant Try.
Sourcepub fn as_try_stmt(&self) -> Option<&Box<TryStmt>>
pub fn as_try_stmt(&self) -> Option<&Box<TryStmt>>
Returns Some if self is a reference of variant Try, and None otherwise.
Sourcepub fn is_while_stmt(&self) -> bool
pub fn is_while_stmt(&self) -> bool
Returns true if self is of variant While.
Sourcepub fn as_while_stmt(&self) -> Option<&WhileStmt>
pub fn as_while_stmt(&self) -> Option<&WhileStmt>
Returns Some if self is a reference of variant While, and None otherwise.
Sourcepub fn is_do_while(&self) -> bool
pub fn is_do_while(&self) -> bool
Returns true if self is of variant DoWhile.
Sourcepub fn as_do_while(&self) -> Option<&DoWhileStmt>
pub fn as_do_while(&self) -> Option<&DoWhileStmt>
Returns Some if self is a reference of variant DoWhile, and None otherwise.
Sourcepub fn is_for_stmt(&self) -> bool
pub fn is_for_stmt(&self) -> bool
Returns true if self is of variant For.
Sourcepub fn as_for_stmt(&self) -> Option<&ForStmt>
pub fn as_for_stmt(&self) -> Option<&ForStmt>
Returns Some if self is a reference of variant For, and None otherwise.
Sourcepub fn as_for_in(&self) -> Option<&ForInStmt>
pub fn as_for_in(&self) -> Option<&ForInStmt>
Returns Some if self is a reference of variant ForIn, and None otherwise.
Sourcepub fn as_for_of(&self) -> Option<&ForOfStmt>
pub fn as_for_of(&self) -> Option<&ForOfStmt>
Returns Some if self is a reference of variant ForOf, and None otherwise.
Sourcepub fn as_decl(&self) -> Option<&Decl>
pub fn as_decl(&self) -> Option<&Decl>
Returns Some if self is a reference of variant Decl, and None otherwise.
Sourcepub fn as_expr(&self) -> Option<&ExprStmt>
pub fn as_expr(&self) -> Option<&ExprStmt>
Returns Some if self is a reference of variant Expr, and None otherwise.
pub fn is_use_strict(&self) -> bool
Sourcepub fn can_precede_directive(&self) -> bool
pub fn can_precede_directive(&self) -> bool
Returns true if the statement does not prevent the directives below
self from being directives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TsStmt
impl RefUnwindSafe for TsStmt
impl Send for TsStmt
impl Sync for TsStmt
impl Unpin for TsStmt
impl UnsafeUnpin for TsStmt
impl UnwindSafe for TsStmt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ImplicitClone for Twhere
T: Clone,
impl<T> ImplicitClone for Twhere
T: Clone,
fn clone_quote_var(&self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more