pub struct VectoredWriter<'a, const E: bool = true> { /* private fields */ }
Implementations§
Source§impl<'a, const E: bool> VectoredWriter<'a, E>
impl<'a, const E: bool> VectoredWriter<'a, E>
Sourcepub fn new(bytes: VectoredBufMut<'a>) -> Self
pub fn new(bytes: VectoredBufMut<'a>) -> Self
Create a VectoredWriter
that can write data types sequentially to the vectored bytes
slice.
Sourcepub fn advance(&mut self, amount: usize) -> Result<(), WireError>
pub fn advance(&mut self, amount: usize) -> Result<(), WireError>
Advance the writer’s index forward by the given amount of bytes, returning an error if there are insufficient bytes on the wire to do so.
Sourcepub fn advance_up_to(&mut self, index: usize)
pub fn advance_up_to(&mut self, index: usize)
Advance the writer’s index forward by the given number of bytes, or to the end of the vectored wire if the amount exceeds the number of remaining bytes.
Sourcepub fn finalize(&self) -> Result<(), WireError>
pub fn finalize(&self) -> Result<(), WireError>
Check if the writer has no more bytes left on the vectored wire that can be written
to. If any bytes remain, return WireError::ExtraBytes
; otherwise, return Ok().
Sourcepub fn finalize_after<T>(
action: Result<(), WireError>,
reader: &Self,
) -> Result<(), WireError>
pub fn finalize_after<T>( action: Result<(), WireError>, reader: &Self, ) -> Result<(), WireError>
Check if the writer has no more bytes left on the vectored wire that can be written
to after the given action. If any bytes remain, return WireError::ExtraBytes
;
otherwise, return Ok().
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check whether the writer has any remaining bytes that can be written to.
Sourcepub fn write<T>(&mut self, writable: &T) -> Result<(), WireError>where
T: VectoredWrite + ?Sized,
pub fn write<T>(&mut self, writable: &T) -> Result<(), WireError>where
T: VectoredWrite + ?Sized,
Write the given data type writable
to the vectored wire.
Sourcepub fn write_part<T, const L: usize>(
&mut self,
writable: &T,
) -> Result<(), WireError>where
T: VectoredWritePart,
pub fn write_part<T, const L: usize>(
&mut self,
writable: &T,
) -> Result<(), WireError>where
T: VectoredWritePart,
Write the given data type writable
to L
bytes on the vectored wire.