pub struct Block {
pub matching_source: Fragment,
pub stmts: Vec<Stmt>,
pub tail: Option<Box<Expr>>,
}Available on crate feature
ast-models only.Expand description
A block of statements, optionally ending in a tail expression that gives the block its value.
i.e. { let x = 1; x + 1 }
Fields§
§matching_source: FragmentThe source of the whole block, including the braces.
stmts: Vec<Stmt>The statements in the block, in order.
tail: Option<Box<Expr>>The final expression of the block (without a trailing semicolon), which is the value of the block.
Trait Implementations§
Source§impl AstNode for Block
impl AstNode for Block
Source§fn matching_source(&self) -> &Fragment
fn matching_source(&self) -> &Fragment
Get the Fragment of source code this node was parsed from.
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Forget for Block
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnsafeUnpin for Block
impl UnwindSafe for Block
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more