Skip to main content

QueueReceiver

Struct QueueReceiver 

Source
pub struct QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,
{ /* private fields */ }
Expand description

Encapsulates a Session and a Queue, polling from the Queue to implement Receive.

This is meant to be coupled with a QueueCallback or QueueCallbackRef, transforming a push-oriented callback into a poll-oriented receiver. Payloads dispatched to the QueueCallback/QueueCallbackRef are queued so that they may be polled via Receive::receive.

Queue is a trait, giving users have the flexibility to choose an implementation that satisfies their Publish/Sync requirements.

Implementations§

Source§

impl<Sess, Payload, QueueImpl> QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,

Source

pub fn new(session: Sess, queue: QueueImpl) -> Self

Encapsulate the underlying session and queue

Trait Implementations§

Source§

impl<Sess, Payload, QueueImpl> Debug for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,

Source§

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

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

impl<Sess, Payload, QueueImpl> Flush for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Flush, QueueImpl: Queue<Payload> + 'static, Payload: 'static,

Source§

fn flush(&mut self) -> Result<(), Error>

Flush all pending publish data, blocking until completion.
Source§

impl<Sess, Payload, QueueImpl> Publish for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Publish, QueueImpl: Queue<Payload> + 'static, Payload: 'static,

Source§

type PublishPayload<'a> = <Sess as Publish>::PublishPayload<'a> where Self: 'a

The type given to the publish(..) function.
Source§

fn publish<'a>( &mut self, payload: Self::PublishPayload<'a>, ) -> Result<PublishOutcome<Self::PublishPayload<'a>>, Error>

Write the given payload to the session. Read more
Source§

impl<Sess, Payload, QueueImpl> Receive for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,

Source§

type ReceivePayload<'a> = Payload where Self: 'a

The type returned by the receive(..) function.
Source§

fn receive<'a>( &'a mut self, ) -> Result<ReceiveOutcome<Self::ReceivePayload<'a>>, Error>

Attempt to receive a payload from the session. This will return ReceiveOutcome::Payload when data has been received. ReceiveOutcome::Active can be used to report that work was completed, but data is not ready. This means that only [ReceiveOutcome::None] should be used to indicate to a scheduler that yielding or idling is appropriate.
Source§

impl<Sess, Payload, QueueImpl> Session for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Session, QueueImpl: Queue<Payload>,

Source§

fn drive(&mut self) -> Result<DriveOutcome, Error>

Some implementations will internally buffer payloads or require a duty cycle to drive callbacks. Those implementations will require drive(..) to be called continuously to completely publish and/or receive data. This function will return DriveOutcome::Active if work was done, indicating to any scheduler that more work may be pending. When this function returns DriveOutcome::Idle, only then should it indicate to a scheduler that yielding or idling is appropriate.
Source§

fn status(&self) -> SessionStatus

Check the current session status. Read more

Auto Trait Implementations§

§

impl<Sess, Payload, QueueImpl> Freeze for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Freeze, QueueImpl: Freeze,

§

impl<Sess, Payload, QueueImpl> RefUnwindSafe for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: RefUnwindSafe, QueueImpl: RefUnwindSafe,

§

impl<Sess, Payload, QueueImpl> Send for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Send, QueueImpl: Send,

§

impl<Sess, Payload, QueueImpl> Sync for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Sync, QueueImpl: Sync,

§

impl<Sess, Payload, QueueImpl> Unpin for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: Unpin, QueueImpl: Unpin,

§

impl<Sess, Payload, QueueImpl> UnsafeUnpin for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: UnsafeUnpin, QueueImpl: UnsafeUnpin,

§

impl<Sess, Payload, QueueImpl> UnwindSafe for QueueReceiver<Sess, Payload, QueueImpl>
where Sess: UnwindSafe, QueueImpl: 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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, 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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V