pub struct Buf<'a> { /* private fields */ }Expand description
A fixed-capacity buffer over caller-owned bytes: the allocator-free way to format a value.
use tzcraft::write::Buf;
use tzcraft::write::Write;
let mut storage = [0u8; 64];
let mut buf = Buf::new(&mut storage);
buf.write_str("hello")?;
assert_eq!(buf.as_str(), "hello");Implementations§
Source§impl<'a> Buf<'a>
impl<'a> Buf<'a>
Sourcepub fn new(data: &'a mut [u8]) -> Buf<'a>
pub fn new(data: &'a mut [u8]) -> Buf<'a>
Wrap data as an empty sink; content is appended from offset 0.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for Buf<'a>
impl<'a> Freeze for Buf<'a>
impl<'a> RefUnwindSafe for Buf<'a>
impl<'a> Send for Buf<'a>
impl<'a> Sync for Buf<'a>
impl<'a> Unpin for Buf<'a>
impl<'a> UnsafeUnpin for Buf<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more