Struct allsorts::binary::write::WriteBuffer
source · pub struct WriteBuffer { /* private fields */ }
Expand description
An in-memory buffer that implements WriteContext
.
Implementations§
source§impl WriteBuffer
impl WriteBuffer
sourcepub fn into_inner(self) -> Vec<u8> ⓘ
pub fn into_inner(self) -> Vec<u8> ⓘ
Consume self
and return the inner buffer
Trait Implementations§
source§impl WriteContext for WriteBuffer
impl WriteContext for WriteBuffer
source§fn write_bytes(&mut self, data: &[u8]) -> Result<(), WriteError>
fn write_bytes(&mut self, data: &[u8]) -> Result<(), WriteError>
Write a slice of bytes to a
WriteContext
.source§fn write_zeros(&mut self, count: usize) -> Result<(), WriteError>
fn write_zeros(&mut self, count: usize) -> Result<(), WriteError>
Write the specified number of zero bytes to the
WriteContext
.source§fn bytes_written(&self) -> usize
fn bytes_written(&self) -> usize
The total number of bytes written so far.
source§fn write_placeholder<T, HostType>(
&mut self,
placeholder: Placeholder<T, HostType>,
val: HostType,
) -> Result<T::Output, WriteError>where
T: WriteBinary<HostType>,
fn write_placeholder<T, HostType>(
&mut self,
placeholder: Placeholder<T, HostType>,
val: HostType,
) -> Result<T::Output, WriteError>where
T: WriteBinary<HostType>,
Consumes the placeholder and writes the supplied value into it
source§fn write_placeholder_dep<T, HostType>(
&mut self,
placeholder: Placeholder<T, HostType>,
val: HostType,
args: T::Args,
) -> Result<T::Output, WriteError>where
T: WriteBinaryDep<HostType>,
fn write_placeholder_dep<T, HostType>(
&mut self,
placeholder: Placeholder<T, HostType>,
val: HostType,
args: T::Args,
) -> Result<T::Output, WriteError>where
T: WriteBinaryDep<HostType>,
Consumes the placeholder and writes the supplied value into it.
WriteBinaryDep
versionsource§fn write_array<'a, T>(
&mut self,
array: &ReadArray<'a, T>,
) -> Result<(), WriteError>
fn write_array<'a, T>( &mut self, array: &ReadArray<'a, T>, ) -> Result<(), WriteError>
Write a
ReadArray
instance to a WriteContext
.source§fn write_vec<T, HostType>(
&mut self,
vec: Vec<HostType>,
) -> Result<(), WriteError>where
Self: Sized,
T: WriteBinary<HostType>,
fn write_vec<T, HostType>(
&mut self,
vec: Vec<HostType>,
) -> Result<(), WriteError>where
Self: Sized,
T: WriteBinary<HostType>,
Write a
Vec
into a WriteContext
.source§fn write_iter<T, HostType>(
&mut self,
iter: impl Iterator<Item = HostType>,
) -> Result<(), WriteError>where
Self: Sized,
T: WriteBinary<HostType>,
fn write_iter<T, HostType>(
&mut self,
iter: impl Iterator<Item = HostType>,
) -> Result<(), WriteError>where
Self: Sized,
T: WriteBinary<HostType>,
Write a slice of values into a
WriteContext
.source§fn placeholder<'a, T, HostType>(
&mut self,
) -> Result<Placeholder<T, HostType>, WriteError>where
T: WriteBinary<HostType> + ReadUnchecked,
fn placeholder<'a, T, HostType>(
&mut self,
) -> Result<Placeholder<T, HostType>, WriteError>where
T: WriteBinary<HostType> + ReadUnchecked,
Return a placeholder to
T
in the context for filling in later.source§fn reserve<'a, T, HostType>(
&mut self,
count: usize,
) -> Result<Placeholder<T, &'a HostType>, WriteError>where
T: WriteBinaryDep<&'a HostType>,
fn reserve<'a, T, HostType>(
&mut self,
count: usize,
) -> Result<Placeholder<T, &'a HostType>, WriteError>where
T: WriteBinaryDep<&'a HostType>,
Reserve space for
count
bytes in the context for filling in later.source§fn placeholder_array<'a, T, HostType>(
&mut self,
count: usize,
) -> Result<Vec<Placeholder<T, HostType>>, WriteError>where
T: WriteBinary<HostType> + ReadUnchecked,
fn placeholder_array<'a, T, HostType>(
&mut self,
count: usize,
) -> Result<Vec<Placeholder<T, HostType>>, WriteError>where
T: WriteBinary<HostType> + ReadUnchecked,
Return a
Vec
of count
placeholders of type T
.Auto Trait Implementations§
impl Freeze for WriteBuffer
impl RefUnwindSafe for WriteBuffer
impl Send for WriteBuffer
impl Sync for WriteBuffer
impl Unpin for WriteBuffer
impl UnwindSafe for WriteBuffer
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more