pub struct QueueSender<S, C> { /* private fields */ }
Expand description

An async-supported sending-half of a Queue. This is to support systems that want to asynchronously send items to a receiver, under the assumption that the receiver sends completions to indicate that a request has been finished, and that the send ID can be reused.

Thus, this queue interally allocates, sends, and reuses IDs for requests.

Implementations§

source§

impl<S: Copy, C: Copy> QueueSender<S, C>

source

pub fn new(queue: Queue<S, C>) -> Self

Build a new QueueSender from a Queue.

source

pub fn submit_no_wait(&self, item: S, flags: SubmissionFlags)

Submit a request and don’t wait for a response. WARNING: This will burn a request ID, preventing it from ever being reused. This function is mostly useful for signalling an “end of communication” event across the queue. If you want to submit and not immediately await, you probably should create a task for your async block instead.

source

pub async fn submit_and_wait(&self, item: S) -> Result<C, QueueError>

Submit an item and await a completion.

Auto Trait Implementations§

§

impl<S, C> !ObjSafe for QueueSender<S, C>

§

impl<S, C> !RefUnwindSafe for QueueSender<S, C>

§

impl<S, C> Send for QueueSender<S, C>where C: Send, S: Send,

§

impl<S, C> Sync for QueueSender<S, C>where C: Send + Sync, S: Send + Sync,

§

impl<S, C> Unpin for QueueSender<S, C>

§

impl<S, C> UnwindSafe for QueueSender<S, C>where C: UnwindSafe + RefUnwindSafe, S: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.