pub struct Writable<A: Array<Item = u8>>(_);
Expand description
Newtype wrapper that adds a blanket implementation of core::fmt::Write
to any & all Array
s
This allows alloc-less format strings:
use core::fmt::Write;
use toad_common::{Array, Writable};
let mut stringish = Writable::from(vec![]);
write!(stringish, "Your number is: {}", 123).ok();
assert_eq!(stringish.as_str(), "Your number is: 123");
Attempt to read the data in the buffer
as a UTF8 string slice
Get a slice of the byte buffer
Get a mutable slice of the byte buffer
Get the collection wrapped by this Writable
Converts this type into a shared reference of the (usually inferred) input type.
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.
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
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
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Converts to this type from the input type.
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
Converts the given value to a
String
.
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.