Skip to main content

Indent

Struct Indent 

pub struct Indent<'f, F, I = &'static str>
where F: Write + ?Sized, I: Display,
{ indent: I, needs_indent: bool, f: &'f mut F, }
Expand description

Pads text with leading indentation after every newline

Fields§

§indent: I§needs_indent: bool§f: &'f mut F

Implementations§

§

impl<'f, F, I> Indent<'f, F, I>
where F: Write + ?Sized, I: Display,

pub const fn new(f: &'f mut F, indent: I) -> Indent<'f, F, I>

pub const fn inner(&mut self) -> &mut F

Gets mutable access to the inner Write-adapter

Trait Implementations§

§

impl<F, I> Write for Indent<'_, F, I>
where F: Write + ?Sized, I: Display,

§

fn write_str(&mut self, s: &str) -> Result<(), Error>

Writes a string slice into this writer, returning whether the write succeeded. Read more
§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl<'f, F, I = &'static str> !UnwindSafe for Indent<'f, F, I>

§

impl<'f, F, I> Freeze for Indent<'f, F, I>
where I: Freeze, F: ?Sized,

§

impl<'f, F, I> RefUnwindSafe for Indent<'f, F, I>

§

impl<'f, F, I> Send for Indent<'f, F, I>
where I: Send, F: Send + ?Sized,

§

impl<'f, F, I> Sync for Indent<'f, F, I>
where I: Sync, F: Sync + ?Sized,

§

impl<'f, F, I> Unpin for Indent<'f, F, I>
where I: Unpin, F: ?Sized,

§

impl<'f, F, I> UnsafeUnpin for Indent<'f, F, I>
where I: UnsafeUnpin, F: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<W> FmtAdapter for W
where W: Write + ?Sized,

§

fn indent(&mut self) -> Indent<'_, Self>

Indents by one level.
§

fn indent_with<I>(&mut self, indent: I) -> Indent<'_, Self, I>
where I: Display,

Pastes indent after each newline.
§

fn delimit<O, E>(&mut self, open: O, close: E) -> Delimit<'_, Self, E>
where O: Display, E: Display,

Delimits a section with open and close.
§

fn delimit_indented<O, E>( &mut self, open: O, close: E, ) -> DelimitIndent<'_, Self, E>
where O: Display, E: Display,

Delimits a section with open and close, raising the indent level within.
§

fn list<Iter, Sep>(&mut self, items: Iter, sep: Sep) -> Result<(), Error>
where Iter: IntoIterator, <Iter as IntoIterator>::Item: Display, Sep: Display,

Formats bracketed lists of the kind (Item (Comma Item)*)?
§

fn list_wrap<Iter, Sep, O, E>( &mut self, open: O, items: Iter, sep: Sep, close: E, ) -> Result<(), Error>
where Iter: IntoIterator, <Iter as IntoIterator>::Item: Display, Sep: Display, O: Display, E: Display,

Wraps a list in open and close. This differs from FmtAdapter::delimit because it prints nothing if the list is empty.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.