vmbus_ring

Struct OutgoingRing

Source
pub struct OutgoingRing<M: RingMem> { /* private fields */ }
Expand description

The sending side of a ring buffer.

Implementations§

Source§

impl<M: RingMem> OutgoingRing<M>

Source

pub fn new(mem: M) -> Result<Self, Error>

Returns a new outgoing ring over mem.

Source

pub fn outgoing(&self) -> Result<OutgoingOffset, Error>

Returns the current outgoing offset, for passing to write and ultimately commit_write.

Source

pub fn set_pending_send_size(&self, len: usize) -> Result<(), Error>

Sets the pending send size: the number of bytes that should be free in the ring before the opposite endpoint sends a ring-non-full signal.

Fails if the packet size is larger than the ring’s maximum packet size.

Source

pub fn maximum_packet_size(&self) -> usize

Returns the maximum packet size that can fit in the ring.

Source

pub fn can_write( &self, ptrs: &mut OutgoingOffset, len: usize, ) -> Result<bool, Error>

Returns whether a packet can fit in the ring starting at the specified offset.

Source

pub fn commit_write(&self, ptrs: &mut OutgoingOffset) -> bool

Commits a series of writes that ended at the specified offset, returning whether the opposite endpoint should be signaled.

Source

pub fn write( &self, ptrs: &mut OutgoingOffset, packet: &OutgoingPacket<'_>, ) -> Result<RingRange, WriteError>

Writes the header of the next packet and returns the ring range for the payload. The caller should write the payload, then commit the write (or multiple writes) with commit_write.

Returns Err(RingFull(len)) if the ring is full, where len is the number of bytes needed to write the requested packet.

Trait Implementations§

Source§

impl<M: Debug + RingMem> Debug for OutgoingRing<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: RingMem> Inspect for OutgoingRing<M>

Source§

fn inspect(&self, req: Request<'_>)

Inspects the object.
Source§

impl<M: RingMem> Ring for OutgoingRing<M>

Source§

type Memory = M

The underlying memory type.
Source§

fn mem(&self) -> &Self::Memory

The backing memory of the ring buffer.

Auto Trait Implementations§

§

impl<M> Freeze for OutgoingRing<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for OutgoingRing<M>
where M: RefUnwindSafe,

§

impl<M> Send for OutgoingRing<M>

§

impl<M> Sync for OutgoingRing<M>
where M: Sync,

§

impl<M> Unpin for OutgoingRing<M>
where M: Unpin,

§

impl<M> UnwindSafe for OutgoingRing<M>
where 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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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