pub struct Writable<A: Array<Item = u8>>(_);
Expand description

A writeable byte buffer

(allows using write! and format! without allocations)

use core::fmt::Write as _;

use toad_common::{Array, Writable};

let mut faux_string = Writable::<tinyvec::ArrayVec<[u8; 16]>>::default();
write!(faux_string, "{}", 123).unwrap();

assert_eq!(faux_string.as_str(), "123");

Implementations

Convert the buffer to a string slice

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Writes a string slice into this writer, returning whether the write succeeded. Read more
Writes a char into this writer, returning whether the write succeeded. Read more
Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.