pub struct StmtBlock { /* private fields */ }
Expand description
(internals) A scoped block of statements.
Exported under the internals
feature only.
Implementations§
source§impl StmtBlock
impl StmtBlock
sourcepub fn new(
statements: impl IntoIterator<Item = Stmt>,
start_pos: Position,
end_pos: Position
) -> Self
pub fn new( statements: impl IntoIterator<Item = Stmt>, start_pos: Position, end_pos: Position ) -> Self
Create a new StmtBlock
.
sourcepub fn new_with_span(
statements: impl IntoIterator<Item = Stmt>,
span: Span
) -> Self
pub fn new_with_span( statements: impl IntoIterator<Item = Stmt>, span: Span ) -> Self
Create a new StmtBlock
.
sourcepub fn statements(&self) -> &[Stmt]
pub fn statements(&self) -> &[Stmt]
Get the statements of this statements block.
sourcepub fn statements_mut(&mut self) -> &mut SmallVec<[Stmt; 8]>
pub fn statements_mut(&mut self) -> &mut SmallVec<[Stmt; 8]>
Get the statements of this statements block.
sourcepub fn iter(&self) -> impl Iterator<Item = &Stmt>
pub fn iter(&self) -> impl Iterator<Item = &Stmt>
Get an iterator over the statements of this statements block.
sourcepub const fn position(&self) -> Position
pub const fn position(&self) -> Position
Get the start position (location of the beginning {
) of this statements block.
sourcepub const fn end_position(&self) -> Position
pub const fn end_position(&self) -> Position
Get the end position (location of the ending }
) of this statements block.
sourcepub const fn span(&self) -> Span
pub const fn span(&self) -> Span
Get the positions (locations of the beginning {
and ending }
) of this statements block.
sourcepub const fn span_or_else(
&self,
def_start_pos: Position,
def_end_pos: Position
) -> Span
pub const fn span_or_else( &self, def_start_pos: Position, def_end_pos: Position ) -> Span
Get the positions (locations of the beginning {
and ending }
) of this statements block
or a default.
sourcepub fn set_position(&mut self, start_pos: Position, end_pos: Position)
pub fn set_position(&mut self, start_pos: Position, end_pos: Position)
Set the positions of this statements block.
Trait Implementations§
source§impl Extend<Stmt> for StmtBlock
impl Extend<Stmt> for StmtBlock
source§fn extend<T: IntoIterator<Item = Stmt>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Stmt>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<'a> IntoIterator for &'a StmtBlock
impl<'a> IntoIterator for &'a StmtBlock
Auto Trait Implementations§
impl Freeze for StmtBlock
impl !RefUnwindSafe for StmtBlock
impl !Send for StmtBlock
impl !Sync for StmtBlock
impl Unpin for StmtBlock
impl !UnwindSafe for StmtBlock
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> Variant for T
impl<T> Variant for T
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant
trait object to &mut dyn Any
.source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant
trait object to Box<dyn Any>
.