pub enum BlockStmtOrExpr {
BlockStmt(BlockStmt),
Expr(Box<Expr>),
}
Variants§
Implementations§
source§impl BlockStmtOrExpr
impl BlockStmtOrExpr
sourcepub const fn is_block_stmt(&self) -> bool
pub const fn is_block_stmt(&self) -> bool
Returns true
if self
is of variant BlockStmt
.
sourcepub fn as_block_stmt(&self) -> Option<&BlockStmt>
pub fn as_block_stmt(&self) -> Option<&BlockStmt>
Returns Some
if self
is a reference of variant BlockStmt
, and None
otherwise.
sourcepub fn as_mut_block_stmt(&mut self) -> Option<&mut BlockStmt>
pub fn as_mut_block_stmt(&mut self) -> Option<&mut BlockStmt>
Returns Some
if self
is a mutable reference of variant BlockStmt
, and None
otherwise.
sourcepub fn expect_block_stmt(self) -> BlockStmtwhere
Self: Debug,
pub fn expect_block_stmt(self) -> BlockStmtwhere
Self: Debug,
sourcepub fn block_stmt(self) -> Option<BlockStmt>
pub fn block_stmt(self) -> Option<BlockStmt>
Returns Some
if self
is of variant BlockStmt
, and None
otherwise.
sourcepub fn as_expr(&self) -> Option<&Box<Expr>>
pub fn as_expr(&self) -> Option<&Box<Expr>>
Returns Some
if self
is a reference of variant Expr
, and None
otherwise.
sourcepub fn as_mut_expr(&mut self) -> Option<&mut Box<Expr>>
pub fn as_mut_expr(&mut self) -> Option<&mut Box<Expr>>
Returns Some
if self
is a mutable reference of variant Expr
, and None
otherwise.
sourcepub fn expect_expr(self) -> Box<Expr>where
Self: Debug,
pub fn expect_expr(self) -> Box<Expr>where
Self: Debug,
Trait Implementations§
source§impl Clone for BlockStmtOrExpr
impl Clone for BlockStmtOrExpr
source§fn clone(&self) -> BlockStmtOrExpr
fn clone(&self) -> BlockStmtOrExpr
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BlockStmtOrExpr
impl Debug for BlockStmtOrExpr
source§impl<'de> Deserialize<'de> for BlockStmtOrExpr
impl<'de> Deserialize<'de> for BlockStmtOrExpr
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl EqIgnoreSpan for BlockStmtOrExpr
impl EqIgnoreSpan for BlockStmtOrExpr
fn eq_ignore_span(&self, other: &Self) -> bool
source§impl From<BlockStmt> for BlockStmtOrExpr
impl From<BlockStmt> for BlockStmtOrExpr
source§impl<T> From<T> for BlockStmtOrExpr
impl<T> From<T> for BlockStmtOrExpr
source§impl Hash for BlockStmtOrExpr
impl Hash for BlockStmtOrExpr
source§impl PartialEq for BlockStmtOrExpr
impl PartialEq for BlockStmtOrExpr
source§impl Serialize for BlockStmtOrExpr
impl Serialize for BlockStmtOrExpr
source§impl Spanned for BlockStmtOrExpr
impl Spanned for BlockStmtOrExpr
source§impl Take for BlockStmtOrExpr
impl Take for BlockStmtOrExpr
impl Eq for BlockStmtOrExpr
impl StructuralPartialEq for BlockStmtOrExpr
Auto Trait Implementations§
impl Freeze for BlockStmtOrExpr
impl RefUnwindSafe for BlockStmtOrExpr
impl Send for BlockStmtOrExpr
impl Sync for BlockStmtOrExpr
impl Unpin for BlockStmtOrExpr
impl UnwindSafe for BlockStmtOrExpr
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
Mutably borrows from an owned value. Read more
§impl<T> CallHasher for T
impl<T> CallHasher for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Converts
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>
Converts
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> SpanExt for Twhere
T: Spanned,
impl<T> SpanExt for Twhere
T: Spanned,
fn is_synthesized(&self) -> bool
fn starts_on_new_line(&self, format: ListFormat) -> bool
source§fn comment_range(&self) -> Span
fn comment_range(&self) -> Span
Gets a custom text range to use when emitting comments.