Skip to main content

Writer

Struct Writer 

Source
struct Writer<'a, 'f> {
    out: &'a mut Formatter<'f>,
    indent: usize,
}

Fields§

§out: &'a mut Formatter<'f>§indent: usize

Implementations§

Source§

impl Writer<'_, '_>

Source

fn line(&mut self, text: &str) -> Result

Source

fn pad(&mut self) -> Result

Source

fn nested(&mut self, write: impl FnOnce(&mut Self) -> Result) -> Result

Source

fn comment(&mut self, node: &Annotated) -> Result

Source

fn mapping(&mut self, entries: &Entries, lead: Lead) -> Result

Write the entries at the current indent. The lead tells whether the caller has already written the indent of the first entry.

Source

fn sequence(&mut self, items: &[Annotated], lead: Lead) -> Result

Write the items at the current indent. The lead tells whether the caller has already written the indent of the first item.

Source

fn after_marker(&mut self, node: &Annotated, marker: Marker) -> Result

Write what follows a key: or - marker and end the line.

A container under a dash starts on the dash line unless its first child has a comment. Under a key it starts on the next line.

Source

fn lead(marker: Marker, first: Option<&Annotated>) -> Lead

Whether a container starts on the line of its marker.

Source

fn block( &mut self, lead: Lead, write: impl FnOnce(&mut Self, Lead) -> Result, ) -> Result

Source

fn scalar(&mut self, scalar: &Scalar) -> Result

Write a scalar and end the line.

Source

fn literal(&mut self, block: &LiteralBlock<'_>) -> Result

Auto Trait Implementations§

§

impl<'a, 'f> !RefUnwindSafe for Writer<'a, 'f>

§

impl<'a, 'f> !Send for Writer<'a, 'f>

§

impl<'a, 'f> !Sync for Writer<'a, 'f>

§

impl<'a, 'f> !UnwindSafe for Writer<'a, 'f>

§

impl<'a, 'f> Freeze for Writer<'a, 'f>

§

impl<'a, 'f> Unpin for Writer<'a, 'f>

§

impl<'a, 'f> UnsafeUnpin for Writer<'a, 'f>

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
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 = !

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.