Struct core::num::fmt::Formatted

source ·
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>

source

pub fn len(&self) -> usize

🔬This is a nightly-only experimental API. (numfmt)

Returns the exact byte length of combined formatted result.

source

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

🔬This is a nightly-only experimental API. (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§

source§

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

source§

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

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> UnwindSafe for Formatted<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> SizedTypeProperties for T

source§

const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.