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>
impl<'p, 'w, W: Write> DesignatorWriter<'p, 'w, W>
fn new( printer: &'p SpanPrinter, wtr: &'w mut W, has_calendar: bool, signum: i8, ) -> DesignatorWriter<'p, 'w, W>
fn maybe_write_prefix_sign(&mut self) -> Result<(), Error>
fn maybe_write_suffix_sign(&mut self) -> Result<(), Error>
fn maybe_write_zero(&mut self) -> Result<(), Error>
fn write(&mut self, unit: Unit, value: impl Into<i64>) -> Result<(), Error>
fn write_fractional_duration( &mut self, unit: FractionalUnit, duration: &SignedDuration, ) -> Result<(), Error>
fn finish_preceding(&mut self) -> Result<(), Error>
Trait Implementations§
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> 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