Trait LoopControl

Source
pub trait LoopControl {
    // Required methods
    fn is_end(&self) -> bool;
    fn revert_to_previous_pointer(&mut self);
    fn set_action(&mut self, action: InterpreterAction);
    fn action(&mut self) -> &mut Option<InterpreterAction>;

    // Provided method
    fn is_not_end(&self) -> bool { ... }
}
Expand description

Trait controls execution of the loop.

Required Methods§

Source

fn is_end(&self) -> bool

Is end of the loop.

Source

fn revert_to_previous_pointer(&mut self)

Reverts to previous instruction pointer.

After the loop is finished, the instruction pointer is set to the previous one.

Source

fn set_action(&mut self, action: InterpreterAction)

Set return action and set instruction pointer to null. Preserve previous pointer

Previous pointer can be restored by calling LoopControl::revert_to_previous_pointer.

Source

fn action(&mut self) -> &mut Option<InterpreterAction>

Takes next action.

Provided Methods§

Source

fn is_not_end(&self) -> bool

Returns true if the loop should continue.

Implementors§