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

A receiver-side async-enabled queue abstraction.

Implementations§

source§

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

source

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

Create a new CallbackQueueReceiver from a Queue.

source

pub async fn handle<F, Fut>(&self, f: F) -> Result<(), QueueError>where F: FnOnce(u32, S) -> Fut, Fut: Future<Output = C>,

Handle a request in a closure that returns a completion.

source

pub async fn receive(&self) -> Result<(u32, S), QueueError>

Receive a request without immediately returning a completion.

source

pub async fn complete(&self, id: u32, reply: C) -> Result<(), QueueError>

Send a completion back to the sender.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<S, C> UnwindSafe for CallbackQueueReceiver<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.