pub struct Formatter<'a> { /* private fields */ }
Expand description
Configures how a scope is formatted.
Implementations
sourceimpl<'a> Formatter<'a>
impl<'a> Formatter<'a>
sourcepub fn new(dst: &'a mut String) -> Self
pub fn new(dst: &'a mut String) -> Self
Return a new formatter that writes to the given string.
sourcepub fn block<F>(&mut self, f: F) -> Resultwhere
F: FnOnce(&mut Self) -> Result,
pub fn block<F>(&mut self, f: F) -> Resultwhere
F: FnOnce(&mut Self) -> Result,
Wrap the given function inside a block.
sourcepub fn indent<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
pub fn indent<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
Call the given function with the indentation level incremented by one.
sourcepub fn is_start_of_line(&self) -> bool
pub fn is_start_of_line(&self) -> bool
Check if current destination is the start of a new line.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Formatter<'a>
impl<'a> Send for Formatter<'a>
impl<'a> Sync for Formatter<'a>
impl<'a> Unpin for Formatter<'a>
impl<'a> !UnwindSafe for Formatter<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more