Struct ForSpan

Source
pub struct ForSpan {
    pub iter: VarRef,
    pub iter_pos: LineCol,
    pub iter_double: bool,
    pub start: Expr,
    pub end: Expr,
    pub next: Expr,
    pub body: Vec<Statement>,
}
Expand description

Components of a FOR statement.

Note that we do not store the original end and step values, and instead use expressions to represent the loop condition and the computation of the next iterator value. We do this for run-time efficiency. The reason this is possible is because we force the step to be an integer literal at parse time and do not allow it to be an expression.

Fields§

§iter: VarRef

Iterator name, expressed as a variable reference that must be either automatic or an integer.

§iter_pos: LineCol

Position of the iterator.

§iter_double: bool

If true, the iterator computation needs to be performed as a double so that, when the iterator variable is not yet defined, it gains the correct type.

§start: Expr

Expression to compute the iterator’s initial value.

§end: Expr

Condition to test after each iteration.

§next: Expr

Expression to compute the iterator’s next value.

§body: Vec<Statement>

Statements within the loop’s body.

Trait Implementations§

Source§

impl Debug for ForSpan

Source§

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

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

impl PartialEq for ForSpan

Source§

fn eq(&self, other: &ForSpan) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ForSpan

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.