Skip to main content

WritableChain

Struct WritableChain 

Source
pub struct WritableChain<M: MemOps> { /* private fields */ }
Expand description

A reply chain with writable buffer capacity.

§Example

ⓘ
if let ReplyChain::Writable(mut wc) = reply {
    wc.write_all(b"response data")?;
    consumer.complete(recv, wc)?;
}

Implementations§

Source§

impl<M: MemOps> WritableChain<M>

Source

pub fn token(&self) -> Token

The token identifying this writable reply.

Source

pub fn capacity(&self) -> usize

Total reply capacity in bytes.

Source

pub fn desc_count(&self) -> usize

Number of writable descriptors in this chain.

Source

pub fn written(&self) -> usize

Number of bytes written so far.

Source

pub fn remaining(&self) -> usize

Remaining reply capacity.

Source

pub fn write(&mut self, buf: &[u8]) -> Result<usize, VirtqError>

Write bytes into writable buffers, returning how many were written.

Appends at the current write position. If buf is larger than the remaining capacity, writes as many bytes as will fit (partial write). Segmentation is intentionally hidden; host-side writes must go through MemOps::write. If a later memory write fails, the cursor and written length retain any earlier chunks written by the same call.

§Errors
Source

pub fn write_all(&mut self, buf: &[u8]) -> Result<&mut Self, VirtqError>

Write the entire buffer or return an error.

§Errors
Source

pub fn rewind(&mut self)

Rewind the write cursor to the beginning.

Previously written bytes in shared memory are not zeroed; the written count is simply reset to 0.

Trait Implementations§

Source§

impl<M: MemOps> From<WritableChain<M>> for ReplyChain<M>

Source§

fn from(wc: WritableChain<M>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<M> Freeze for WritableChain<M>
where ChainState<M>: Freeze,

§

impl<M> RefUnwindSafe for WritableChain<M>
where ChainState<M>: RefUnwindSafe,

§

impl<M> Send for WritableChain<M>
where ChainState<M>: Send,

§

impl<M> Sync for WritableChain<M>
where ChainState<M>: Sync,

§

impl<M> Unpin for WritableChain<M>
where ChainState<M>: Unpin,

§

impl<M> UnsafeUnpin for WritableChain<M>
where ChainState<M>: UnsafeUnpin,

§

impl<M> UnwindSafe for WritableChain<M>
where ChainState<M>: UnwindSafe,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more