Struct NumBuffer

pub struct NumBuffer<T: NumBufferTrait> { pub(crate) buf: T::Buf, pub(in ::fmt::num_buffer) phantom: PhantomData<T> }

A buffer wrapper of which the internal size is based on the maximum number of digits the associated integer can have.

Examples

use core::fmt::NumBuffer;

let mut buf = NumBuffer::new();
let n1 = 1972u32;
assert_eq!(n1.format_into(&mut buf), "1972");

// Formatting a negative integer includes the sign.
let mut buf = NumBuffer::new();
let n2 = -1972i32;
assert_eq!(n2.format_into(&mut buf), "-1972");

Fields

buf: T::Buf
phantom: PhantomData<T>

Implementations

impl<T: NumBufferTrait> NumBuffer<T>

const fn new() -> Self

Initializes internal buffer.

Trait Implementations

impl<T: NumBufferTrait> Debug for NumBuffer<T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<T> Freeze for NumBuffer<T> where <T as NumBufferTrait>::Buf: Freeze, PhantomData<T>: Freeze,

impl<T> RefUnwindSafe for NumBuffer<T> where <T as NumBufferTrait>::Buf: RefUnwindSafe, PhantomData<T>: RefUnwindSafe,

impl<T> Send for NumBuffer<T> where <T as NumBufferTrait>::Buf: Send, PhantomData<T>: Send,

impl<T> Sync for NumBuffer<T> where <T as NumBufferTrait>::Buf: Sync, PhantomData<T>: Sync,

impl<T> Unpin for NumBuffer<T> where <T as NumBufferTrait>::Buf: Unpin, PhantomData<T>: Unpin,

impl<T> UnsafeUnpin for NumBuffer<T> where <T as NumBufferTrait>::Buf: UnsafeUnpin, PhantomData<T>: UnsafeUnpin,

impl<T> UnwindSafe for NumBuffer<T> where <T as NumBufferTrait>::Buf: UnwindSafe, PhantomData<T>: UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for NumBuffer<T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for NumBuffer<T> where T: ?Sized,

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

impl<T> From<T> for NumBuffer<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for NumBuffer<T> where T: ?Sized,

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

impl<T> SizedTypeProperties for NumBuffer<T>

impl<T, U> Into<U> for NumBuffer<T> 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 NumBuffer<T> 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 NumBuffer<T> where U: TryFrom<T>,

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