pub(crate) struct Output<W>where
W: ?Sized,{
pub(crate) bytes_written: usize,
pub(crate) output: W,
}formatting only.Expand description
An io::Writer that keeps track of the number of bytes written to it.
Fields§
§bytes_written: usizeThe number of bytes written to the output.
output: WThe output that bytes are written to.
Implementations§
Source§impl<W> Output<W>
impl<W> Output<W>
Sourcepub(super) fn format_iso8601_date<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
pub(super) fn format_iso8601_date<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
Format the date portion of ISO 8601.
Sourcepub(super) fn format_iso8601_time<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
pub(super) fn format_iso8601_time<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
Format the time portion of ISO 8601.
Sourcepub(super) fn format_iso8601_offset<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
pub(super) fn format_iso8601_offset<V, const CONFIG: EncodedConfig>(
&mut self,
value: &V,
state: &mut V::State,
) -> Result<(), Format>where
V: ComponentProvider,
Format the UTC offset portion of ISO 8601.
Source§impl<W> Output<W>
impl<W> Output<W>
Sourcepub(crate) fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
pub(crate) fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
Write the string to the output.
Sourcepub(crate) fn write_many<const N: usize>(
&mut self,
arr: [&str; N],
) -> Result<()>
pub(crate) fn write_many<const N: usize>( &mut self, arr: [&str; N], ) -> Result<()>
Write all strings to the output (in order).
Sourcepub(crate) fn write_if(&mut self, pred: bool, s: &str) -> Result<()>
pub(crate) fn write_if(&mut self, pred: bool, s: &str) -> Result<()>
Write the string to the output if and only if pred is true.
Sourcepub(crate) fn write_if_else(
&mut self,
pred: bool,
true_str: &str,
false_str: &str,
) -> Result<()>
pub(crate) fn write_if_else( &mut self, pred: bool, true_str: &str, false_str: &str, ) -> Result<()>
If and only if pred is true, write true_str to the output. Otherwise, write false_str.
Sourcefn format_int_padded(&mut self, value: u64, width: u8) -> Result<()>
fn format_int_padded(&mut self, value: u64, width: u8) -> Result<()>
Write an integer with zeros as trailing padding if necessary to reach the requested width.
This function is intended to be used for formatting the fractional part of a value, as the trailing zeros would change the semantic meaning for non-fractional values.
Sourcepub(crate) fn format_float(
&mut self,
value: f64,
digits_before_decimal: u8,
digits_after_decimal: Option<NonZero<u8>>,
) -> Result<()>
pub(crate) fn format_float( &mut self, value: f64, digits_before_decimal: u8, digits_after_decimal: Option<NonZero<u8>>, ) -> Result<()>
Write the floating point number to the output.
This method accepts the number of digits before and after the decimal. The value will be padded with zeroes to the left if necessary.
Sourcepub(crate) fn format_single_digit(&mut self, value: ru8<0, 9>) -> Result<()>
pub(crate) fn format_single_digit(&mut self, value: ru8<0, 9>) -> Result<()>
Format a single digit.
Sourcepub(crate) fn format_two_digits(
&mut self,
value: ru8<0, 99>,
padding: Padding,
) -> Result<()>
pub(crate) fn format_two_digits( &mut self, value: ru8<0, 99>, padding: Padding, ) -> Result<()>
Format a two digit number with the specified padding.
Sourcepub(crate) fn format_three_digits(
&mut self,
value: ru16<0, 999>,
padding: Padding,
) -> Result<()>
pub(crate) fn format_three_digits( &mut self, value: ru16<0, 999>, padding: Padding, ) -> Result<()>
Format a three digit number with the specified padding.
Sourcepub(crate) fn format_four_digits(
&mut self,
value: ru16<0, 9_999>,
padding: Padding,
) -> Result<()>
pub(crate) fn format_four_digits( &mut self, value: ru16<0, 9_999>, padding: Padding, ) -> Result<()>
Format a four digit number with the specified padding.
Sourcepub(crate) fn format_four_digits_pad_zero(
&mut self,
value: ru16<0, 9_999>,
) -> Result<()>
pub(crate) fn format_four_digits_pad_zero( &mut self, value: ru16<0, 9_999>, ) -> Result<()>
Format a four digit number that is padded with zeroes.
Sourcepub(crate) fn format_five_digits_pad_zero(
&mut self,
value: ru32<0, 99_999>,
) -> Result<()>
pub(crate) fn format_five_digits_pad_zero( &mut self, value: ru32<0, 99_999>, ) -> Result<()>
Format a five digit number that is padded with zeroes.
Sourcepub(crate) fn format_six_digits_pad_zero(
&mut self,
value: ru32<0, 999_999>,
) -> Result<()>
pub(crate) fn format_six_digits_pad_zero( &mut self, value: ru32<0, 999_999>, ) -> Result<()>
Format a six digit number that is padded with zeroes.
Sourcepub(crate) fn format_u64_pad_none(&mut self, value: u64) -> Result<()>
pub(crate) fn format_u64_pad_none(&mut self, value: u64) -> Result<()>
Format a number with no padding.
If the sign is mandatory, the sign must be written by the caller.
Sourcepub(crate) fn format_u128_pad_none(&mut self, value: u128) -> Result<()>
pub(crate) fn format_u128_pad_none(&mut self, value: u128) -> Result<()>
Format a number with no padding.
If the sign is mandatory, the sign must be written by the caller.
Sourcefn fmt_day(&mut self, day: ru8<1, 31>, _: Day) -> Result<(), Error>
fn fmt_day(&mut self, day: ru8<1, 31>, _: Day) -> Result<(), Error>
Format the day into the designated output.
Sourcefn fmt_month_short(&mut self, month: Month, _: MonthShort) -> Result<()>
fn fmt_month_short(&mut self, month: Month, _: MonthShort) -> Result<()>
Format the month into the designated output using the abbreviated name.
Sourcefn fmt_month_long(&mut self, month: Month, _: MonthLong) -> Result<()>
fn fmt_month_long(&mut self, month: Month, _: MonthLong) -> Result<()>
Format the month into the designated output using the full name.
Sourcefn fmt_month_numerical(&mut self, month: Month, _: MonthNumerical) -> Result<()>
fn fmt_month_numerical(&mut self, month: Month, _: MonthNumerical) -> Result<()>
Format the month into the designated output as a number from 1-12.
Sourcefn fmt_ordinal(
&mut self,
ordinal: ru16<1, 366>,
_: Ordinal,
) -> Result<(), Error>
fn fmt_ordinal( &mut self, ordinal: ru16<1, 366>, _: Ordinal, ) -> Result<(), Error>
Format the ordinal into the designated output.
Sourcefn fmt_weekday_short(&mut self, weekday: Weekday, _: WeekdayShort) -> Result<()>
fn fmt_weekday_short(&mut self, weekday: Weekday, _: WeekdayShort) -> Result<()>
Format the weekday into the designated output using the abbreviated name.
Sourcefn fmt_weekday_long(&mut self, weekday: Weekday, _: WeekdayLong) -> Result<()>
fn fmt_weekday_long(&mut self, weekday: Weekday, _: WeekdayLong) -> Result<()>
Format the weekday into the designated output using the full name.
Sourcefn fmt_weekday_sunday(
&mut self,
weekday: Weekday,
_: WeekdaySunday,
) -> Result<()>
fn fmt_weekday_sunday( &mut self, weekday: Weekday, _: WeekdaySunday, ) -> Result<()>
Format the weekday into the designated output as a number from either 0-6 or 1-7 (depending on the modifier), where Sunday is either 0 or 1.
Sourcefn fmt_weekday_monday(
&mut self,
weekday: Weekday,
_: WeekdayMonday,
) -> Result<()>
fn fmt_weekday_monday( &mut self, weekday: Weekday, _: WeekdayMonday, ) -> Result<()>
Format the weekday into the designated output as a number from either 0-6 or 1-7 (depending on the modifier), where Monday is either 0 or 1.
fn fmt_week_number_iso( &mut self, week_number: ru8<1, 53>, _: WeekNumberIso, ) -> Result<()>
fn fmt_week_number_sunday( &mut self, week_number: ru8<0, 53>, _: WeekNumberSunday, ) -> Result<()>
fn fmt_week_number_monday( &mut self, week_number: ru8<0, 53>, _: WeekNumberMonday, ) -> Result<()>
fn fmt_calendar_year_full_extended_range( &mut self, full_year: ri32<-999_999, 999_999>, _: CalendarYearFullExtendedRange, ) -> Result<()>
fn fmt_calendar_year_full_standard_range( &mut self, full_year: ri16<-9_999, 9_999>, _: CalendarYearFullStandardRange, ) -> Result<()>
fn fmt_iso_year_full_extended_range( &mut self, full_year: ri32<-999_999, 999_999>, _: IsoYearFullExtendedRange, ) -> Result<()>
fn fmt_iso_year_full_standard_range( &mut self, year: ri16<-9_999, 9_999>, _: IsoYearFullStandardRange, ) -> Result<()>
fn fmt_calendar_year_century_extended_range( &mut self, century: ri16<-9_999, 9_999>, is_negative: bool, _: CalendarYearCenturyExtendedRange, ) -> Result<()>
fn fmt_calendar_year_century_standard_range( &mut self, century: ri8<-99, 99>, is_negative: bool, _: CalendarYearCenturyStandardRange, ) -> Result<()>
fn fmt_iso_year_century_extended_range( &mut self, century: ri16<-9_999, 9_999>, is_negative: bool, _: IsoYearCenturyExtendedRange, ) -> Result<()>
fn fmt_iso_year_century_standard_range( &mut self, century: ri8<-99, 99>, is_negative: bool, _: IsoYearCenturyStandardRange, ) -> Result<()>
fn fmt_calendar_year_last_two( &mut self, last_two: ru8<0, 99>, _: CalendarYearLastTwo, ) -> Result<()>
fn fmt_iso_year_last_two( &mut self, last_two: ru8<0, 99>, _: IsoYearLastTwo, ) -> Result<()>
Sourcefn fmt_hour_12(&mut self, hour: ru8<0, { _ }>, _: Hour12) -> Result<()>
fn fmt_hour_12(&mut self, hour: ru8<0, { _ }>, _: Hour12) -> Result<()>
Format the hour into the designated output using the 12-hour clock.
Sourcefn fmt_hour_24(&mut self, hour: ru8<0, { _ }>, _: Hour24) -> Result<()>
fn fmt_hour_24(&mut self, hour: ru8<0, { _ }>, _: Hour24) -> Result<()>
Format the hour into the designated output using the 24-hour clock.
Sourcefn fmt_minute(&mut self, minute: ru8<0, { _ }>, _: Minute) -> Result<(), Error>
fn fmt_minute(&mut self, minute: ru8<0, { _ }>, _: Minute) -> Result<(), Error>
Format the minute into the designated output.
Sourcefn fmt_period(&mut self, period: Period, _: Period) -> Result<(), Error>
fn fmt_period(&mut self, period: Period, _: Period) -> Result<(), Error>
Format the period into the designated output.
Sourcefn fmt_second(&mut self, second: ru8<0, { _ }>, _: Second) -> Result<(), Error>
fn fmt_second(&mut self, second: ru8<0, { _ }>, _: Second) -> Result<(), Error>
Format the second into the designated output.
Sourcefn fmt_subsecond(
&mut self,
nanos: ru32<0, { _ }>,
_: Subsecond,
) -> Result<(), Error>
fn fmt_subsecond( &mut self, nanos: ru32<0, { _ }>, _: Subsecond, ) -> Result<(), Error>
Format the subsecond into the designated output.
fn fmt_sign(&mut self, is_negative: bool, sign_is_mandatory: bool) -> Result<()>
Sourcefn fmt_offset_hour(
&mut self,
is_negative: bool,
hour: ri8<-25, 25>,
_: OffsetHour,
) -> Result<(), Error>
fn fmt_offset_hour( &mut self, is_negative: bool, hour: ri8<-25, 25>, _: OffsetHour, ) -> Result<(), Error>
Format the offset hour into the designated output.
Sourcefn fmt_offset_minute(
&mut self,
offset_minute: ri8<{ _ }, { _ }>,
_: OffsetMinute,
) -> Result<(), Error>
fn fmt_offset_minute( &mut self, offset_minute: ri8<{ _ }, { _ }>, _: OffsetMinute, ) -> Result<(), Error>
Format the offset minute into the designated output.
Sourcefn fmt_offset_second(
&mut self,
offset_second: ri8<{ _ }, { _ }>,
_: OffsetSecond,
) -> Result<(), Error>
fn fmt_offset_second( &mut self, offset_second: ri8<{ _ }, { _ }>, _: OffsetSecond, ) -> Result<(), Error>
Format the offset second into the designated output.
Sourcefn fmt_unix_timestamp_second(
&mut self,
timestamp: i64,
_: UnixTimestampSecond,
) -> Result<(), Error>
fn fmt_unix_timestamp_second( &mut self, timestamp: i64, _: UnixTimestampSecond, ) -> Result<(), Error>
Format the Unix timestamp (in seconds) into the designated output.
Sourcefn fmt_unix_timestamp_millisecond(
&mut self,
timestamp_millis: i64,
_: UnixTimestampMillisecond,
) -> Result<(), Error>
fn fmt_unix_timestamp_millisecond( &mut self, timestamp_millis: i64, _: UnixTimestampMillisecond, ) -> Result<(), Error>
Format the Unix timestamp (in milliseconds) into the designated output.
Sourcefn fmt_unix_timestamp_microsecond(
&mut self,
timestamp_micros: i128,
_: UnixTimestampMicrosecond,
) -> Result<(), Error>
fn fmt_unix_timestamp_microsecond( &mut self, timestamp_micros: i128, _: UnixTimestampMicrosecond, ) -> Result<(), Error>
Format the Unix timestamp (in microseconds) into the designated output.
Sourcefn fmt_unix_timestamp_nanosecond(
&mut self,
timestamp_nanos: i128,
_: UnixTimestampNanosecond,
) -> Result<(), Error>
fn fmt_unix_timestamp_nanosecond( &mut self, timestamp_nanos: i128, _: UnixTimestampNanosecond, ) -> Result<(), Error>
Format the Unix timestamp (in nanoseconds) into the designated output.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Output<W>
impl<W> RefUnwindSafe for Output<W>where
W: RefUnwindSafe + ?Sized,
impl<W> Send for Output<W>
impl<W> Sync for Output<W>
impl<W> Unpin for Output<W>
impl<W> UnsafeUnpin for Output<W>where
W: UnsafeUnpin + ?Sized,
impl<W> UnwindSafe for Output<W>where
W: UnwindSafe + ?Sized,
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
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more