Struct bevy_api_gen_lib::writer::PrettyWriter
source · pub struct PrettyWriter { /* private fields */ }
Expand description
Used to generate pretty indented code
Implementations§
source§impl PrettyWriter
impl PrettyWriter
pub fn new() -> Self
sourcepub fn extend(&mut self, other: PrettyWriter)
pub fn extend(&mut self, other: PrettyWriter)
Combines this writer with another one.
open brackets are inherited, the current string is indented with additional indentation to match this writers indentation level. If the indentation level is non-zero, it’s added to this writer’s. Any prefixes are ignored.
sourcepub fn write_line(&mut self, line: &str) -> &mut Self
pub fn write_line(&mut self, line: &str) -> &mut Self
Writes a line at the current indentation level and append a newline at the end
sourcepub fn write_no_newline(&mut self, line: &str) -> &mut Self
pub fn write_no_newline(&mut self, line: &str) -> &mut Self
Writes without adding newline but keeps the indentation
sourcepub fn write_postfixed_line(&mut self, line: &str, postfix: &str) -> &mut Self
pub fn write_postfixed_line(&mut self, line: &str, postfix: &str) -> &mut Self
Writes a postfixed (after main text, before newline) line at the current indentation level and append a newline at the end
sourcepub fn write_inline(&mut self, line: &str) -> &mut Self
pub fn write_inline(&mut self, line: &str) -> &mut Self
Writes a line without adding indentation or a newline
sourcepub fn write_indentation(&mut self) -> &mut Self
pub fn write_indentation(&mut self) -> &mut Self
Writes indentation only, useful if you need to follow this by write_inline
sourcepub fn set_prefix(&mut self, prefix: Cow<'static, str>) -> &mut Self
pub fn set_prefix(&mut self, prefix: Cow<'static, str>) -> &mut Self
Sets a prefix to be appended before every line written
sourcepub fn clear_prefix(&mut self) -> &mut Self
pub fn clear_prefix(&mut self) -> &mut Self
Clears the set prefix
sourcepub fn indent(&mut self) -> &mut Self
pub fn indent(&mut self) -> &mut Self
Increases intendation level permamently, does not write to the output yet
sourcepub fn dedent(&mut self) -> &mut Self
pub fn dedent(&mut self) -> &mut Self
Decrases intendation level permamently, does not write to the output yet
sourcepub fn open_paren(&mut self) -> &mut Self
pub fn open_paren(&mut self) -> &mut Self
Opens parenthesised section
sourcepub fn close_paren(&mut self) -> &mut Self
pub fn close_paren(&mut self) -> &mut Self
Closes parenthesised section
sourcepub fn open_brace(&mut self) -> &mut Self
pub fn open_brace(&mut self) -> &mut Self
Opens braceed section
sourcepub fn close_brace(&mut self) -> &mut Self
pub fn close_brace(&mut self) -> &mut Self
Closes braced section
sourcepub fn open_bracket(&mut self) -> &mut Self
pub fn open_bracket(&mut self) -> &mut Self
Opens bracketed section
sourcepub fn close_bracket(&mut self) -> &mut Self
pub fn close_bracket(&mut self) -> &mut Self
Closes bracketed section