Struct WriteBuffer

pub struct WriteBuffer<const SIZE: usize> { /* private fields */ }

A buffer for construct a string while avoiding heap allocation.

The only requirement is that the buffer is large enough to hold the formatted string.

Implementations

impl<const SIZE: usize> WriteBuffer<SIZE>

const fn new() -> Self

Creates an empty buffer.

fn as_str(&self) -> &str

Obtain the contents of the buffer as a string.

const fn remaining_capacity(&self) -> usize

Determine how many bytes are remaining in the buffer.

Trait Implementations

impl<const LEFT_SIZE: usize, const RIGHT_SIZE: usize> PartialEq<WriteBuffer<RIGHT_SIZE>> for WriteBuffer<LEFT_SIZE>

fn eq(&self, other: &WriteBuffer<RIGHT_SIZE>) -> bool

impl<const LEFT_SIZE: usize, const RIGHT_SIZE: usize> PartialOrd<WriteBuffer<RIGHT_SIZE>> for WriteBuffer<LEFT_SIZE>

fn partial_cmp(&self, other: &WriteBuffer<RIGHT_SIZE>) -> Option<Ordering>

impl<const SIZE: usize> AsRef<[u8]> for WriteBuffer<SIZE>

fn as_ref(&self) -> &[u8]

impl<const SIZE: usize> AsRef<str> for WriteBuffer<SIZE>

fn as_ref(&self) -> &str

impl<const SIZE: usize> Borrow<str> for WriteBuffer<SIZE>

fn borrow(&self) -> &str

impl<const SIZE: usize> Debug for WriteBuffer<SIZE>

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

impl<const SIZE: usize> Default for WriteBuffer<SIZE>

fn default() -> Self

impl<const SIZE: usize> Deref for WriteBuffer<SIZE>

type Target = str;
fn deref(&self) -> &Self::Target

impl<const SIZE: usize> Display for WriteBuffer<SIZE>

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

impl<const SIZE: usize> Eq for WriteBuffer<SIZE>

impl<const SIZE: usize> Hash for WriteBuffer<SIZE>

fn hash<H: Hasher>(&self, state: &mut H)

impl<const SIZE: usize> Ord for WriteBuffer<SIZE>

fn cmp(&self, other: &Self) -> Ordering

impl<const SIZE: usize> SmartDisplay for WriteBuffer<SIZE>

type Metadata = ();
fn metadata(&self, FormatterOptions) -> Metadata<'_, Self>
fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<const SIZE: usize> Write for WriteBuffer<SIZE>

fn write_str(&mut self, s: &str) -> Result

Auto Trait Implementations

impl<const SIZE: usize> Freeze for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: Freeze,

impl<const SIZE: usize> RefUnwindSafe for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: RefUnwindSafe,

impl<const SIZE: usize> Send for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: Send,

impl<const SIZE: usize> Sync for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: Sync,

impl<const SIZE: usize> Unpin for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: Unpin,

impl<const SIZE: usize> UnsafeUnpin for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: UnsafeUnpin,

impl<const SIZE: usize> UnwindSafe for WriteBuffer<SIZE> where [MaybeUninit<u8>; SIZE]: UnwindSafe,

Blanket Implementations

impl<P, T> Receiver for WriteBuffer<SIZE> where P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T;

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for WriteBuffer<SIZE> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for WriteBuffer<SIZE> where T: ?Sized,

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

impl<T> From<T> for WriteBuffer<SIZE>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> TryInto<U> for WriteBuffer<SIZE> where U: TryFrom<T>,

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