pub struct CodeWriter { /* private fields */ }Expand description
An indented buffer of generated code.
Implementations§
Source§impl CodeWriter
impl CodeWriter
Sourcepub fn with_indent(unit: &'static str) -> Self
pub fn with_indent(unit: &'static str) -> Self
A writer indenting by something else.
Sourcepub fn line(&mut self, text: impl AsRef<str>)
pub fn line(&mut self, text: impl AsRef<str>)
Writes one line at the current indentation.
An empty line stays empty rather than becoming indentation, since trailing whitespace is exactly the kind of invisible difference that makes a regenerated file look changed when it is not.
Sourcepub fn comment(&mut self, prefix: &str, text: &str)
pub fn comment(&mut self, prefix: &str, text: &str)
Writes prose as a comment, wrapped, with each line prefixed.
Trait Implementations§
Source§impl Debug for CodeWriter
impl Debug for CodeWriter
Auto Trait Implementations§
impl Freeze for CodeWriter
impl RefUnwindSafe for CodeWriter
impl Send for CodeWriter
impl Sync for CodeWriter
impl Unpin for CodeWriter
impl UnsafeUnpin for CodeWriter
impl UnwindSafe for CodeWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more