pub trait WithStatements: Sized {
Show 13 methods
// Required methods
fn statements(&self) -> &[Box<dyn Statement>];
fn add_boxed_statement(&mut self, statement: Box<dyn Statement>);
// Provided methods
fn with_boxed_statement(self, statement: Box<dyn Statement>) -> Self { ... }
fn add_statement<S>(&mut self, statement: S)
where S: 'static + Statement { ... }
fn with_statement<S>(self, statement: S) -> Self
where S: 'static + Statement { ... }
fn add_literal<L>(&mut self, literal: L)
where L: Into<Literal> { ... }
fn with_literal<L>(self, literal: L) -> Self
where L: Into<Literal> { ... }
fn add_semi<L>(&mut self, literal: L)
where L: Into<Literal> { ... }
fn with_semi<L>(self, literal: L) -> Self
where L: Into<Literal> { ... }
fn add_expression_statement<E>(&mut self, expression: E)
where E: 'static + Expression { ... }
fn with_expression_statement<E>(self, expression: E) -> Self
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 statements.
Required Methods§
Sourcefn statements(&self) -> &[Box<dyn Statement>]
fn statements(&self) -> &[Box<dyn Statement>]
Gets the statements.
Sourcefn add_boxed_statement(&mut self, statement: Box<dyn Statement>)
fn add_boxed_statement(&mut self, statement: Box<dyn Statement>)
Adds the boxed statement
.
Provided Methods§
Sourcefn with_boxed_statement(self, statement: Box<dyn Statement>) -> Self
fn with_boxed_statement(self, statement: Box<dyn Statement>) -> Self
Adds the boxed statement
.
Sourcefn add_statement<S>(&mut self, statement: S)where
S: 'static + Statement,
fn add_statement<S>(&mut self, statement: S)where
S: 'static + Statement,
Adds the statement
.
Sourcefn with_statement<S>(self, statement: S) -> Selfwhere
S: 'static + Statement,
fn with_statement<S>(self, statement: S) -> Selfwhere
S: 'static + Statement,
Adds the statement
.
Sourcefn add_literal<L>(&mut self, literal: L)
fn add_literal<L>(&mut self, literal: L)
Adds the literal
statement.
Sourcefn with_literal<L>(self, literal: L) -> Self
fn with_literal<L>(self, literal: L) -> Self
Adds the literal
statement.
Sourcefn add_expression_statement<E>(&mut self, expression: E)where
E: 'static + Expression,
fn add_expression_statement<E>(&mut self, expression: E)where
E: 'static + Expression,
Adds the expression
as a statement.
Sourcefn with_expression_statement<E>(self, expression: E) -> Selfwhere
E: 'static + Expression,
fn with_expression_statement<E>(self, expression: E) -> Selfwhere
E: 'static + Expression,
Adds the expression
as a statement.
Sourcefn write_statements(&self, b: &mut CodeBuffer, level: usize)
fn write_statements(&self, b: &mut CodeBuffer, level: usize)
Writes the statements.
Sourcefn write_curly_statement_block(&self, b: &mut CodeBuffer, level: usize)
fn write_curly_statement_block(&self, b: &mut CodeBuffer, level: usize)
Writes the curly-bracketed statement block. (level
is the outer level)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.