pub struct Formatted<'a> {
pub sign: &'static str,
pub parts: &'a [Part<'a>],
}🔬This is a nightly-only experimental API. (
numfmt)Expand description
Formatted result containing one or more parts. This can be written to the byte buffer or converted to the allocated string.
Fields§
§sign: &'static str🔬This is a nightly-only experimental API. (
numfmt)A byte slice representing a sign, either "", "-" or "+".
parts: &'a [Part<'a>]🔬This is a nightly-only experimental API. (
numfmt)Formatted parts to be rendered after a sign and optional zero padding.
Implementations§
Source§impl<'a> Formatted<'a>
impl<'a> Formatted<'a>
Sourcepub fn len(&self) -> usize
🔬This is a nightly-only experimental API. (numfmt)
pub fn len(&self) -> usize
numfmt)Returns the byte length of combined formatted result.
Saturates at usize::MAX if the actual length is larger.
This matters on 16-bit targets, where exponential formatting can exceed
usize::MAX by emitting u16::MAX trailing zeroes plus "1." / "e0".
Sourcepub fn write(&self, out: &mut [u8]) -> Option<usize>
🔬This is a nightly-only experimental API. (numfmt)
pub fn write(&self, out: &mut [u8]) -> Option<usize>
numfmt)Writes all formatted parts into the supplied buffer.
Returns the number of written bytes, or None if the buffer is not enough.
(It may still leave partially written bytes in the buffer; do not rely on that.)
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Formatted<'a>
impl<'a> RefUnwindSafe for Formatted<'a>
impl<'a> Send for Formatted<'a>
impl<'a> Sync for Formatted<'a>
impl<'a> Unpin for Formatted<'a>
impl<'a> UnsafeUnpin for Formatted<'a>
impl<'a> UnwindSafe for Formatted<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type #102070)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more