pub trait WithStatements: Sized {
    // Required methods
    fn statements(&self) -> &[Box<dyn Statement>];
    fn add_boxed_statement(&mut self, statement: Box<dyn Statement>);

    // Provided methods
    fn with_statement<S>(self, statement: S) -> Self
       where S: 'static + Statement { ... }
    fn add_statement<S>(&mut self, statement: S)
       where S: 'static + Statement { ... }
    fn with_boxed_statement(self, statement: Box<dyn Statement>) -> Self { ... }
    fn with_expression_statement<E>(self, expression: E) -> Self
       where E: 'static + Expression { ... }
    fn add_expression_statement<E>(&mut self, expression: E)
       where E: 'static + Expression { ... }
    fn write_statements(&self, b: &mut CodeBuffer, level: usize) { ... }
    fn write_curly_statement_block(&self, b: &mut CodeBuffer, level: usize) { ... }
}
Expand description

An element with a list of statements.

Required Methods§

source

fn statements(&self) -> &[Box<dyn Statement>]

Gets the statements.

source

fn add_boxed_statement(&mut self, statement: Box<dyn Statement>)

Adds the boxed statement.

Provided Methods§

source

fn with_statement<S>(self, statement: S) -> Self
where S: 'static + Statement,

Adds the statement.

source

fn add_statement<S>(&mut self, statement: S)
where S: 'static + Statement,

Adds the statement.

source

fn with_boxed_statement(self, statement: Box<dyn Statement>) -> Self

Adds the boxed statement.

source

fn with_expression_statement<E>(self, expression: E) -> Self
where E: 'static + Expression,

Adds the expression as a statement.

source

fn add_expression_statement<E>(&mut self, expression: E)
where E: 'static + Expression,

Adds the expression as a statement.

source

fn write_statements(&self, b: &mut CodeBuffer, level: usize)

Writes the statements.

source

fn write_curly_statement_block(&self, b: &mut CodeBuffer, level: usize)

Writes the curly-bracketed statement block. (level is the outer level)

Object Safety§

This trait is not object safe.

Implementors§