pub struct FmtNum<T>(pub T);Expand description
๐น โ Const number formatter.
๐ text/fmt
Provides a lightweight, allocation-free interface for writing numeric values into an existing byte buffer.
ยงExamples
let mut buf = [0u8; 8];
let len = FmtNum(-123i32).write(&mut buf, 0);
assert_eq!(&buf[..len], b"-123");
let len = FmtNum(42u8).write(&mut buf, 0);
assert_eq!(&buf[..len], b"42");
let float_str = FmtNum(-4.2_f32).as_str_into(&mut buf, 2);
assert_eq!(float_str, "-4.19"); // be aware of floating-point inexactitudesTuple Fieldsยง
ยง0: TImplementationsยง
Sourceยงimpl FmtNum<f32>
impl FmtNum<f32>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize, fract_len: u16) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize, fract_len: u16) -> usize
Writes the floating-point number in fixed-point decimal form into buf
starting at pos, using exactly fract_len fractional digits.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The operation is atomic: on failure, nothing is written.
- Negative values are preceded by the
'-'sign. - Fractional digits are truncated and zero-padded as needed.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the floating-point number in fixed-point decimal form into buf
starting at pos, using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The operation is atomic: on failure, nothing is written.
- The emitted sign, any leading zero-padding, and the number of fractional digits
are controlled by
conf.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted floating-point number with optional digit grouping.
Grouping is applied to the rendered digit sequences on both sides of the radix, after sign emission, zero-padding, and precision handling have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (integral digits + zero padding + grouping separators), excluding the sign.conf.fractspecifies the fractional precision before grouping is applied to the rendered fractional digit sequence.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self, fract_len: u16) -> FmtNumShape
pub const fn measure(self, fract_len: u16) -> FmtNumShape
Returns the measured shape of the floating-point to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the floating-point to be formatted, using the given formatting configuration.
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Grouping assumes 1-byte separators and ASCII digits.
Sourcepub const fn as_bytes_into<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> &'b [u8] โ
pub const fn as_bytes_into<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
This operation is atomic: if the buffer is too small, nothing is writte.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is writte.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as a byte slice.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> &'b str โ
pub const fn as_str_into<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
This operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as a string slice.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self, fract_len: u16) -> StringU8<N>
pub const fn as_string<const N: usize>(&self, fract_len: u16) -> StringU8<N>
Converts the number into an owned fixed-size string.
This operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
This operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(
&self,
fract_len: u16,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>( &self, fract_len: u16, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
This operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
This operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<f64>
impl FmtNum<f64>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize, fract_len: u16) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize, fract_len: u16) -> usize
Writes the floating-point number in fixed-point decimal form into buf
starting at pos, using exactly fract_len fractional digits.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The operation is atomic: on failure, nothing is written.
- Negative values are preceded by the
'-'sign. - Fractional digits are truncated and zero-padded as needed.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the floating-point number in fixed-point decimal form into buf
starting at pos, using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The operation is atomic: on failure, nothing is written.
- The emitted sign, any leading zero-padding, and the number of fractional digits
are controlled by
conf.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted floating-point number with optional digit grouping.
Grouping is applied to the rendered digit sequences on both sides of the radix, after sign emission, zero-padding, and precision handling have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (integral digits + zero padding + grouping separators), excluding the sign.conf.fractspecifies the fractional precision before grouping is applied to the rendered fractional digit sequence.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self, fract_len: u16) -> FmtNumShape
pub const fn measure(self, fract_len: u16) -> FmtNumShape
Returns the measured shape of the floating-point to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the floating-point to be formatted, using the given formatting configuration.
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Grouping assumes 1-byte separators and ASCII digits.
Sourcepub const fn as_bytes_into<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> &'b [u8] โ
pub const fn as_bytes_into<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
This operation is atomic: if the buffer is too small, nothing is writte.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is writte.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as a byte slice.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> &'b str โ
pub const fn as_str_into<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
This operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
fract_len: u16,
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], fract_len: u16, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as a string slice.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
This operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self, fract_len: u16) -> StringU8<N>
pub const fn as_string<const N: usize>(&self, fract_len: u16) -> StringU8<N>
Converts the number into an owned fixed-size string.
This operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
This operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(
&self,
fract_len: u16,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>( &self, fract_len: u16, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
This operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
This operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<i8>
impl FmtNum<i8>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<i8>
impl FmtNum<i8>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<i16>
impl FmtNum<i16>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<i16>
impl FmtNum<i16>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<i32>
impl FmtNum<i32>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<i32>
impl FmtNum<i32>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<i64>
impl FmtNum<i64>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<i64>
impl FmtNum<i64>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<i128>
impl FmtNum<i128>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<i128>
impl FmtNum<i128>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<isize>
impl FmtNum<isize>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- Negative values are preceded by the
'-'sign. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
- The emitted sign and any leading zero-padding are controlled by
conf. - The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer when formatted with the given configuration.
Sourceยงimpl FmtNum<isize>
impl FmtNum<isize>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<u8>
impl FmtNum<u8>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<u8>
impl FmtNum<u8>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<u16>
impl FmtNum<u16>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<u16>
impl FmtNum<u16>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<u32>
impl FmtNum<u32>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<u32>
impl FmtNum<u32>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<u64>
impl FmtNum<u64>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<u64>
impl FmtNum<u64>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<u128>
impl FmtNum<u128>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<u128>
impl FmtNum<u128>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Sourceยงimpl FmtNum<usize>
impl FmtNum<usize>
Sourcepub const fn write(self, buf: &mut [u8], pos: usize) -> usize
pub const fn write(self, buf: &mut [u8], pos: usize) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_fmt(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
) -> usize
pub const fn write_fmt( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, ) -> usize
Writes the integer as ASCII decimal digits into buf starting at pos,
using the given formatting configuration.
Returns the number of bytes written, or 0 if the buffer is too small.
ยงBehavioral guarantees
The emitted sign and any leading zero-padding are controlled by conf.
The operation is atomic: on failure, nothing is written.
Sourcepub const fn write_group(
self,
buf: &mut [u8],
pos: usize,
conf: FmtNumConf,
group: FmtNumGroup,
) -> usize
pub const fn write_group( self, buf: &mut [u8], pos: usize, conf: FmtNumConf, group: FmtNumGroup, ) -> usize
Writes the formatted integer with optional digit grouping.
Grouping is applied to the rendered integral digit sequence, after sign emission and zero-padding have been accounted for.
ยงBehavioral guarantees
- Grouping assumes 1-byte separators and ASCII digits.
conf.intspecifies the minimum width of the entire left block (digits + zero padding + grouping separators), excluding the sign.- On failure, nothing is written (atomic operation).
Sourcepub const fn measure(self) -> FmtNumShape
pub const fn measure(self) -> FmtNumShape
Returns the measured shape of the integer to be formatted.
Sourcepub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
pub const fn measure_fmt(self, conf: FmtNumConf) -> FmtNumShape
Returns the measured shape of the integer to be formatted, using the given formatting configuration.
Sourceยงimpl FmtNum<usize>
impl FmtNum<usize>
Sourcepub const fn measure_group(
self,
conf: FmtNumConf,
group: FmtNumGroup,
) -> FmtNumShape
pub const fn measure_group( self, conf: FmtNumConf, group: FmtNumGroup, ) -> FmtNumShape
Returns the measured shape of the number after applying digit grouping.
This first measures the formatted number using measure_fmt, then
accounts for any additional separator glyphs introduced by grouping.
Sourcepub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
pub const fn as_bytes_into<'b>(&self, buf: &'b mut [u8]) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b [u8] โ
pub const fn as_bytes_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b [u8] โ
Formats the number into a provided buffer and returns it as a byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
Sourcepub const fn as_bytes_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_bytes_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b [u8]> โ
pub const fn as_bytes_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b [u8]> โ
Formats the number into a provided buffer and returns it as some byte slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
Sourcepub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
pub const fn as_str_into<'b>(&self, buf: &'b mut [u8]) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> &'b str โ
pub const fn as_str_into_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> &'b str โ
Formats the number into a provided buffer and returns it as a string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked<'b>(
&self,
buf: &'b mut [u8],
) -> Option<&'b str> โ
pub const fn as_str_into_checked<'b>( &self, buf: &'b mut [u8], ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice.
The operation is atomic: if the buffer is too small, nothing is written
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_str_into_checked_fmt<'b>(
&self,
buf: &'b mut [u8],
conf: FmtNumConf,
) -> Option<&'b str> โ
pub const fn as_str_into_checked_fmt<'b>( &self, buf: &'b mut [u8], conf: FmtNumConf, ) -> Option<&'b str> โ
Formats the number into a provided buffer and returns it as some string slice, using the given formatting configuration.
The operation is atomic: if the buffer is too small, nothing is written,
and it returns None.
ยงFeatures
Uses the unsafe_str feature to avoid duplicated validation.
Sourcepub const fn as_string<const N: usize>(&self) -> StringU8<N>
pub const fn as_string<const N: usize>(&self) -> StringU8<N>
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> StringU8<N>
pub const fn as_string_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> StringU8<N>
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns an empty string.
Sourcepub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
pub const fn as_string_checked<const N: usize>(&self) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string.
The operation is atomic: if the buffer is too small, it returns None.
Sourcepub const fn as_string_checked_fmt<const N: usize>(
&self,
conf: FmtNumConf,
) -> Option<StringU8<N>> โ
pub const fn as_string_checked_fmt<const N: usize>( &self, conf: FmtNumConf, ) -> Option<StringU8<N>> โ
Converts the number into an owned fixed-size string, using the given formatting configuration.
The operation is atomic: if the buffer is too small, it returns None.
Trait Implementationsยง
impl<T: Copy> Copy for FmtNum<T>
impl<T: Eq> Eq for FmtNum<T>
Sourceยงimpl<T: Ord> Ord for FmtNum<T>
impl<T: Ord> Ord for FmtNum<T>
1.21.0 (const: unstable) ยท Sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงimpl<T: PartialEq> PartialEq for FmtNum<T>
impl<T: PartialEq> PartialEq for FmtNum<T>
Sourceยงimpl<T: PartialOrd> PartialOrd for FmtNum<T>
impl<T: PartialOrd> PartialOrd for FmtNum<T>
impl<T> StructuralPartialEq for FmtNum<T>
Auto Trait Implementationsยง
impl<T> Freeze for FmtNum<T>where
T: Freeze,
impl<T> RefUnwindSafe for FmtNum<T>where
T: RefUnwindSafe,
impl<T> Send for FmtNum<T>where
T: Send,
impl<T> Sync for FmtNum<T>where
T: Sync,
impl<T> Unpin for FmtNum<T>where
T: Unpin,
impl<T> UnsafeUnpin for FmtNum<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for FmtNum<T>where
T: UnwindSafe,
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.