pub struct BufWriter<A>where
A: Allocator,{ /* private fields */ }Expand description
A writer that writes against an underlying Vec.
Implementations§
Source§impl<A> BufWriter<A>where
A: Allocator,
impl<A> BufWriter<A>where
A: Allocator,
Sourcepub fn new(alloc: A) -> Self
pub fn new(alloc: A) -> Self
Construct a new buffer writer.
§Examples
use musli::alloc::Global;
use musli::writer::BufWriter;
let writer = BufWriter::new(Global::new());Sourcepub fn into_inner(self) -> Vec<u8, A>
pub fn into_inner(self) -> Vec<u8, A>
Coerce into inner buffer.
§Examples
use musli::alloc::Global;
use musli::writer::BufWriter;
let writer = BufWriter::new(Global::new());
let buffer = writer.into_inner();
assert!(buffer.is_empty());Trait Implementations§
Source§impl<A> Writer for BufWriter<A>where
A: Allocator,
impl<A> Writer for BufWriter<A>where
A: Allocator,
Source§fn finish<C>(&mut self, _: C) -> Result<Self::Ok, C::Error>where
C: Context,
fn finish<C>(&mut self, _: C) -> Result<Self::Ok, C::Error>where
C: Context,
Finalize the writer and return the output.
Source§fn borrow_mut(&mut self) -> Self::Mut<'_>
fn borrow_mut(&mut self) -> Self::Mut<'_>
Reborrow the current type. Read more
Source§fn extend<C>(
&mut self,
cx: C,
buffer: Vec<u8, C::Allocator>,
) -> Result<(), C::Error>where
C: Context,
fn extend<C>(
&mut self,
cx: C,
buffer: Vec<u8, C::Allocator>,
) -> Result<(), C::Error>where
C: Context,
Write a buffer to the current writer. Read more
Auto Trait Implementations§
impl<A> Freeze for BufWriter<A>
impl<A> RefUnwindSafe for BufWriter<A>
impl<A> Send for BufWriter<A>
impl<A> Sync for BufWriter<A>
impl<A> Unpin for BufWriter<A>
impl<A> UnsafeUnpin for BufWriter<A>
impl<A> UnwindSafe for BufWriter<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