pub struct AsyncSender<T>(/* private fields */);Expand description
The asynchronous sender endpoint for a VMO-backed FIFO queue.
Implementations§
Source§impl<T: FromBytes + IntoBytes + KnownLayout + Copy> AsyncSender<T>
impl<T: FromBytes + IntoBytes + KnownLayout + Copy> AsyncSender<T>
Sourcepub fn new(
vmo: Vmo,
alignment: usize,
queue_capacity: u32,
) -> Result<Self, Status>
pub fn new( vmo: Vmo, alignment: usize, queue_capacity: u32, ) -> Result<Self, Status>
Creates a new AsyncSender.
vmo- The shared VMO used for queue messages and payload buffers.alignment- The byte alignment boundaries required for allocations. Modulo padding is applied so that all payload offsets begin aligned to this size. Must be a power of two.queue_capacity- The maximum number of queue slots.
pub fn is_full(&self) -> bool
pub fn vmo(&self) -> &Vmo
Sourcepub async fn push(&mut self, msg: T) -> Result<u64, Status>
pub async fn push(&mut self, msg: T) -> Result<u64, Status>
Pushes a standalone message onto the queue, yielding to the executor if the queue is full.
Sourcepub async fn reserve_payload(
&mut self,
size: usize,
) -> Result<AsyncPayloadBuffer<'_, T>, Status>
pub async fn reserve_payload( &mut self, size: usize, ) -> Result<AsyncPayloadBuffer<'_, T>, Status>
Reserves a payload buffer in the VMO. Yields to the executor if there is insufficient
payload capacity available. Returns an AsyncPayloadBuffer that commits on success
or rolls back on drop.
Auto Trait Implementations§
impl<T> Freeze for AsyncSender<T>
impl<T> RefUnwindSafe for AsyncSender<T>where
T: RefUnwindSafe,
impl<T> Send for AsyncSender<T>where
T: Send,
impl<T> Sync for AsyncSender<T>where
T: Sync,
impl<T> Unpin for AsyncSender<T>where
T: Unpin,
impl<T> UnsafeUnpin for AsyncSender<T>
impl<T> UnwindSafe for AsyncSender<T>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more