Struct rune::ast::ExprFor[][src]

pub struct ExprFor {
    pub attributes: Vec<Attribute>,
    pub label: Option<(Label, Colon)>,
    pub for_token: For,
    pub binding: Pat,
    pub in_: In,
    pub iter: Expr,
    pub body: Box<Block>,
}

A for loop over an iterator: for i in [1, 2, 3] {}.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ExprFor>("for i in x {}");
testing::roundtrip::<ast::ExprFor>("for (a, _) in x {}");
testing::roundtrip::<ast::ExprFor>("'label: for i in x {}");
testing::roundtrip::<ast::ExprFor>("#[attr] 'label: for i in x {}");

Fields

attributes: Vec<Attribute>

The attributes of the for loop

label: Option<(Label, Colon)>

The label of the loop.

for_token: For

The for keyword.

binding: Pat

The pattern binding to use. Non-trivial pattern bindings will panic if the value doesn’t match.

in_: In

The in keyword.

iter: Expr

Expression producing the iterator.

body: Box<Block>

The body of the loop.

Trait Implementations

impl Clone for ExprFor[src]

impl Debug for ExprFor[src]

impl Eq for ExprFor[src]

impl Parse for ExprFor[src]

impl PartialEq<ExprFor> for ExprFor[src]

impl Spanned for ExprFor[src]

impl StructuralEq for ExprFor[src]

impl StructuralPartialEq for ExprFor[src]

impl ToTokens for ExprFor[src]

Auto Trait Implementations

impl RefUnwindSafe for ExprFor

impl Send for ExprFor

impl Sync for ExprFor

impl Unpin for ExprFor

impl UnwindSafe for ExprFor

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.