pub struct QueueReceiver<Sess, Payload, QueueImpl>{ /* 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§
Trait Implementations§
Source§impl<Sess, Payload, QueueImpl> Debug for QueueReceiver<Sess, Payload, QueueImpl>
impl<Sess, Payload, QueueImpl> Debug for QueueReceiver<Sess, Payload, QueueImpl>
Source§impl<Sess, Payload, QueueImpl> Flush for QueueReceiver<Sess, Payload, QueueImpl>
impl<Sess, Payload, QueueImpl> Flush for QueueReceiver<Sess, Payload, QueueImpl>
Source§impl<Sess, Payload, QueueImpl> Publish for QueueReceiver<Sess, Payload, QueueImpl>
impl<Sess, Payload, QueueImpl> Publish for QueueReceiver<Sess, Payload, QueueImpl>
Source§type PublishPayload<'a> = <Sess as Publish>::PublishPayload<'a>
where
Self: 'a
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>
fn publish<'a>( &mut self, payload: Self::PublishPayload<'a>, ) -> Result<PublishOutcome<Self::PublishPayload<'a>>, Error>
Write the given
payload to the session. Read moreSource§impl<Sess, Payload, QueueImpl> Receive for QueueReceiver<Sess, Payload, QueueImpl>
impl<Sess, Payload, QueueImpl> Receive for QueueReceiver<Sess, Payload, QueueImpl>
Source§type ReceivePayload<'a> = Payload
where
Self: 'a
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>
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>
impl<Sess, Payload, QueueImpl> Session for QueueReceiver<Sess, Payload, QueueImpl>
Source§fn drive(&mut self) -> Result<DriveOutcome, Error>
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
fn status(&self) -> SessionStatus
Check the current session status. Read more
Auto Trait Implementations§
impl<Sess, Payload, QueueImpl> Freeze for QueueReceiver<Sess, Payload, QueueImpl>
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>
impl<Sess, Payload, QueueImpl> Sync for QueueReceiver<Sess, Payload, QueueImpl>
impl<Sess, Payload, QueueImpl> Unpin for QueueReceiver<Sess, Payload, QueueImpl>
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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