pub struct WriteCounter { /* private fields */ }
Expand description
A WriteContext
implementation that just counts the bytes written.
Implementations
sourceimpl WriteCounter
impl WriteCounter
Trait Implementations
sourceimpl WriteContext for WriteCounter
impl WriteContext for WriteCounter
sourcefn 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
.
sourcefn 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
.
sourcefn bytes_written(&self) -> usize
fn bytes_written(&self) -> usize
The total number of bytes written so far.
sourcefn 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
sourcefn write_array<'a, T>(
&mut self,
array: &ReadArray<'a, T>
) -> Result<(), WriteError> where
Self: Sized,
T: ReadUnchecked<'a> + WriteBinary<<T as ReadUnchecked<'a>>::HostType>,
fn write_array<'a, T>(
&mut self,
array: &ReadArray<'a, T>
) -> Result<(), WriteError> where
Self: Sized,
T: ReadUnchecked<'a> + WriteBinary<<T as ReadUnchecked<'a>>::HostType>,
Write a ReadArray
instance to a WriteContext
.
sourcefn write_vec<'a, T>(
&mut self,
vec: Vec<<T as ReadUnchecked<'a>>::HostType>
) -> Result<(), WriteError> where
Self: Sized,
T: ReadUnchecked<'a> + WriteBinary<<T as ReadUnchecked<'a>>::HostType>,
fn write_vec<'a, T>(
&mut self,
vec: Vec<<T as ReadUnchecked<'a>>::HostType>
) -> Result<(), WriteError> where
Self: Sized,
T: ReadUnchecked<'a> + WriteBinary<<T as ReadUnchecked<'a>>::HostType>,
Write a Vec
into a WriteContext
.
sourcefn placeholder<'a, T, HostType>(
&mut self
) -> Result<Placeholder<T, HostType>, WriteError> where
T: WriteBinary<HostType> + ReadUnchecked<'a>,
fn placeholder<'a, T, HostType>(
&mut self
) -> Result<Placeholder<T, HostType>, WriteError> where
T: WriteBinary<HostType> + ReadUnchecked<'a>,
Return a placeholder to T
in the context for filling in later.
sourcefn reserve<'a, T, HostType>(
&mut self,
count: usize
) -> Result<Placeholder<T, &'a HostType>, WriteError> where
T: WriteBinary<&'a HostType>,
fn reserve<'a, T, HostType>(
&mut self,
count: usize
) -> Result<Placeholder<T, &'a HostType>, WriteError> where
T: WriteBinary<&'a HostType>,
Reserve space for count
bytes in the context for filling in later.
sourcefn placeholder_array<'a, T, HostType>(
&mut self,
count: usize
) -> Result<Vec<Placeholder<T, HostType>>, WriteError> where
T: WriteBinary<HostType> + ReadUnchecked<'a>,
fn placeholder_array<'a, T, HostType>(
&mut self,
count: usize
) -> Result<Vec<Placeholder<T, HostType>>, WriteError> where
T: WriteBinary<HostType> + ReadUnchecked<'a>,
Return a Vec
of count
placeholders of type T
.
Auto Trait Implementations
impl RefUnwindSafe for WriteCounter
impl Send for WriteCounter
impl Sync for WriteCounter
impl Unpin for WriteCounter
impl UnwindSafe for WriteCounter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more