Struct Formatted

pub struct Formatted<'a> { pub sign: &'static str, pub parts: &'a [Part<'a>] }

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

A byte slice representing a sign, either "", "-" or "+".

parts: &'a [Part<'a>]

Formatted parts to be rendered after a sign and optional zero padding.

Implementations

impl<'a> Formatted<'a>

fn len(&self) -> usize

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

fn write(&self, out: &mut [u8]) -> Option<usize>

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

impl<'a> Clone for Formatted<'a>

fn clone(&self) -> Formatted<'a>

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

impl<T> Any for Formatted<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Formatted<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Formatted<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Formatted<'a> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Formatted<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Formatted<'a> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Formatted<'a>

impl<T, U> Into<U> for Formatted<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Formatted<'a> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for Formatted<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>