Struct VectoredWriter

Source
pub struct VectoredWriter<'a, const E: bool = true> { /* private fields */ }

Implementations§

Source§

impl<'a, const E: bool> VectoredWriter<'a, E>

Source

pub fn new(bytes: VectoredBufMut<'a>) -> Self

Create a VectoredWriter that can write data types sequentially to the vectored bytes slice.

Source

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.

Source

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.

Source

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().

Source

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().

Source

pub fn is_empty(&self) -> bool

Check whether the writer has any remaining bytes that can be written to.

Source

pub fn write<T>(&mut self, writable: &T) -> Result<(), WireError>
where T: VectoredWrite + ?Sized,

Write the given data type writable to the vectored wire.

Source

pub fn write_part<T, const L: usize>( &mut self, writable: &T, ) -> Result<(), WireError>

Write the given data type writable to L bytes on the vectored wire.

Trait Implementations§

Source§

impl From<VectoredWriter<'_>> for WireIndex

Source§

fn from(writer: VectoredWriter<'_>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, const E: bool> Freeze for VectoredWriter<'a, E>

§

impl<'a, const E: bool> RefUnwindSafe for VectoredWriter<'a, E>

§

impl<'a, const E: bool> Send for VectoredWriter<'a, E>

§

impl<'a, const E: bool> Sync for VectoredWriter<'a, E>

§

impl<'a, const E: bool> Unpin for VectoredWriter<'a, E>

§

impl<'a, const E: bool = true> !UnwindSafe for VectoredWriter<'a, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.