Struct lib_ruby_parser::nodes::If[][src]

#[repr(C)]
pub struct If { pub cond: Box<Node>, pub if_true: Option<Box<Node>>, pub if_false: Option<Box<Node>>, pub keyword_l: Loc, pub begin_l: Loc, pub else_l: Option<Loc>, pub end_l: Option<Loc>, pub expression_l: Loc, }
Expand description

Represents an if statement (i.e. if foo; bar; else; baz; end)

Fields

cond: Box<Node>

Condition given to the if statement, Lvar("a") for if a; b; else; c; end

if_true: Option<Box<Node>>

True-branch of the if statement, Lvar("b") for if a; b; else; c; end

if_false: Option<Box<Node>>

False-branch of the if statement, Lvar("c") for if a; b; else; c; end

keyword_l: Loc

Location of the if keyword

if foo; end
~~
begin_l: Loc

Location of the then keyword

if foo then; end
       ~~~~

None if then keyword is omitted

else_l: Option<Loc>

Location of the else keyword

if foo; else; end
        ~~~~

None if there’s no else branch

end_l: Option<Loc>

Location of the end keyword

if foo; end
        ~~~
expression_l: Loc

Location of the full expression

if a then; b; else; c end
~~~~~~~~~~~~~~~~~~~~~~~~~

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.