Struct rune::ast::ExprIf[][src]

pub struct ExprIf {
    pub attributes: Vec<Attribute>,
    pub if_: If,
    pub condition: Condition,
    pub block: Box<Block>,
    pub expr_else_ifs: Vec<ExprElseIf>,
    pub expr_else: Option<ExprElse>,
}

An if statement: if cond { true } else { false }

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ExprIf>("if 0 {  }");
testing::roundtrip::<ast::ExprIf>("if 0 {  } else {  }");
testing::roundtrip::<ast::ExprIf>("if 0 {  } else if 0 {  } else {  }");
testing::roundtrip::<ast::ExprIf>("if let v = v {  }");
testing::roundtrip::<ast::ExprIf>("#[attr] if 1 {} else {}");

Fields

attributes: Vec<Attribute>

The attributes of the if statement

if_: If

The if token.

condition: Condition

The condition to the if statement.

block: Box<Block>

The body of the if statement.

expr_else_ifs: Vec<ExprElseIf>

Else if branches.

expr_else: Option<ExprElse>

The else part of the if expression.

Implementations

impl ExprIf[src]

pub fn parse_with_meta(
    parser: &mut Parser<'_>,
    attributes: Vec<Attribute>
) -> Result<Self, ParseError>
[src]

Parse #ident and attach the given meta

Trait Implementations

impl Clone for ExprIf[src]

impl Debug for ExprIf[src]

impl Eq for ExprIf[src]

impl Parse for ExprIf[src]

impl PartialEq<ExprIf> for ExprIf[src]

impl Spanned for ExprIf[src]

impl StructuralEq for ExprIf[src]

impl StructuralPartialEq for ExprIf[src]

impl ToTokens for ExprIf[src]

Auto Trait Implementations

impl RefUnwindSafe for ExprIf

impl Send for ExprIf

impl Sync for ExprIf

impl Unpin for ExprIf

impl UnwindSafe for ExprIf

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.