Struct code_builder::CodeBuilder
[−]
[src]
pub struct CodeBuilder { /* fields omitted */ }
Methods
impl CodeBuilder
[src]
pub fn add_line<S>(&mut self, line: S) where
S: AsRef<str>,
[src]
S: AsRef<str>,
Adds a single line of code to this code builder, formatting it based on previous code.
pub fn add<S>(&mut self, code: S) where
S: AsRef<str>,
[src]
S: AsRef<str>,
Adds one or more lines (split by "\n") to this code builder.
pub fn add_code(&mut self, builder: &CodeBuilder)
[src]
Adds the result of another CodeBuilder.
pub fn result(&self) -> &str
[src]
Returns the code in this code builder so far.
pub fn new() -> CodeBuilder
[src]
Returns a new CodeBuilder.
pub fn with_indent_size(indent_size: i32) -> CodeBuilder
[src]
Returns a new CodeBuilder with the given indent size.
pub fn format<S>(indent_size: i32, code: S) -> String where
S: AsRef<str>,
[src]
S: AsRef<str>,
Returns a formatted string using the CodeBuilder.