jiff::fmt::friendly::printer

Struct DesignatorWriter

Source
struct DesignatorWriter<'p, 'w, W> {
    printer: &'p SpanPrinter,
    wtr: &'w mut W,
    desig: Designators,
    sign: Option<DirectionSign>,
    fmtint: DecimalFormatter,
    fmtfraction: FractionalFormatter,
    written_non_zero_unit: bool,
}
Expand description

An abstraction for writing the “designator” variant of the friendly format.

This takes care of computing some initial state and keeping track of some mutable state that influences printing. For example, whether to write a delimiter or not (one should only come after a unit that has been written).

Fields§

§printer: &'p SpanPrinter§wtr: &'w mut W§desig: Designators§sign: Option<DirectionSign>§fmtint: DecimalFormatter§fmtfraction: FractionalFormatter§written_non_zero_unit: bool

Implementations§

Source§

impl<'p, 'w, W: Write> DesignatorWriter<'p, 'w, W>

Source

fn new( printer: &'p SpanPrinter, wtr: &'w mut W, has_calendar: bool, signum: i8, ) -> DesignatorWriter<'p, 'w, W>

Source

fn maybe_write_prefix_sign(&mut self) -> Result<(), Error>

Source

fn maybe_write_suffix_sign(&mut self) -> Result<(), Error>

Source

fn maybe_write_zero(&mut self) -> Result<(), Error>

Source

fn write(&mut self, unit: Unit, value: impl Into<i64>) -> Result<(), Error>

Source

fn write_fractional_duration( &mut self, unit: FractionalUnit, duration: &SignedDuration, ) -> Result<(), Error>

Source

fn finish_preceding(&mut self) -> Result<(), Error>

Trait Implementations§

Source§

impl<'p, 'w, W: Debug> Debug for DesignatorWriter<'p, 'w, W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'p, 'w, W> Freeze for DesignatorWriter<'p, 'w, W>

§

impl<'p, 'w, W> RefUnwindSafe for DesignatorWriter<'p, 'w, W>
where W: RefUnwindSafe,

§

impl<'p, 'w, W> Send for DesignatorWriter<'p, 'w, W>
where W: Send,

§

impl<'p, 'w, W> Sync for DesignatorWriter<'p, 'w, W>
where W: Sync,

§

impl<'p, 'w, W> Unpin for DesignatorWriter<'p, 'w, W>

§

impl<'p, 'w, W> !UnwindSafe for DesignatorWriter<'p, 'w, W>

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