Struct rhai::StmtBlock

source ·
pub struct StmtBlock { /* private fields */ }
Expand description

(internals) A scoped block of statements. Exported under the internals feature only.

Implementations§

source§

impl StmtBlock

source

pub const NONE: Self = _

A StmtBlock that does not exist.

source

pub fn new( statements: impl IntoIterator<Item = Stmt>, start_pos: Position, end_pos: Position ) -> Self

Create a new StmtBlock.

source

pub fn new_with_span( statements: impl IntoIterator<Item = Stmt>, span: Span ) -> Self

Create a new StmtBlock.

source

pub const fn empty(pos: Position) -> Self

Create an empty StmtBlock.

source

pub fn is_empty(&self) -> bool

Returns true if this statements block contains no statements.

source

pub fn len(&self) -> usize

Number of statements in this statements block.

source

pub fn statements(&self) -> &[Stmt]

Get the statements of this statements block.

source

pub fn statements_mut(&mut self) -> &mut SmallVec<[Stmt; 8]>

Get the statements of this statements block.

source

pub fn iter(&self) -> impl Iterator<Item = &Stmt>

Get an iterator over the statements of this statements block.

source

pub const fn position(&self) -> Position

Get the start position (location of the beginning {) of this statements block.

source

pub const fn end_position(&self) -> Position

Get the end position (location of the ending }) of this statements block.

source

pub const fn span(&self) -> Span

Get the positions (locations of the beginning { and ending }) of this statements block.

source

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.

source

pub fn set_position(&mut self, start_pos: Position, end_pos: Position)

Set the positions of this statements block.

Trait Implementations§

source§

impl AsMut<[Stmt]> for StmtBlock

source§

fn as_mut(&mut self) -> &mut [Stmt]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[Stmt]> for StmtBlock

source§

fn as_ref(&self) -> &[Stmt]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<[Stmt]> for StmtBlock

source§

fn borrow(&self) -> &[Stmt]

Immutably borrows from an owned value. Read more
source§

impl Clone for StmtBlock

source§

fn clone(&self) -> StmtBlock

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StmtBlock

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for StmtBlock

source§

fn default() -> StmtBlock

Returns the “default value” for a type. Read more
source§

impl Extend<Stmt> for StmtBlock

source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

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 From<Stmt> for StmtBlock

source§

fn from(stmt: Stmt) -> Self

Converts to this type from the input type.
source§

impl Hash for StmtBlock

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> IntoIterator for &'a StmtBlock

§

type Item = &'a Stmt

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, Stmt>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for StmtBlock

§

type Item = Stmt

The type of the elements being iterated over.
§

type IntoIter = IntoIter<[Stmt; 8]>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Variant for T
where T: Any + Clone + SendSync,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert this Variant trait object to &dyn Any.
source§

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>

Convert this Variant trait object to Box<dyn Any>.
source§

fn type_name(&self) -> &'static str

Get the name of this type.
source§

fn clone_object(&self) -> Box<dyn Variant>

Clone this Variant trait object.