Skip to content

struct

IfBlock

pub struct IfBlock {
    pub cond: Path,
    pub negated: bool,
    pub compare: Option<(CmpOp, Value)>,
    pub then_branch: Vec<Node>,
    pub else_branch: Vec<Node>,
    pub expr: Option<Expr>,
}

if [!]cond { … } else { … }

Fields

cond

pub cond: Path

The condition, when it's a path (if busy, if !busy, if n > 3); otherwise expr holds it and this is _.

negated

pub negated: bool

Whether the condition is negated: if !busy.

compare

pub compare: Option<(CmpOp, Value)>

if cond <op> value — compares the condition's value instead of testing its truthiness.

then_branch

pub then_branch: Vec<Node>

Nodes shown when the condition holds.

else_branch

pub else_branch: Vec<Node>

Nodes shown when it doesn't (else, and else if as a nested if).

expr

pub expr: Option<Expr>

A condition that isn't one of the forms above: if a && b.

Trait implementations