pub struct Unsolicited { /* private fields */ }Expand description
A queue of frames the peer pushed while some other call was in flight.
Draining rather than cloning: the frames are the peer’s, and a caller that polls in a loop should get each one exactly once.
Implementations§
Source§impl Unsolicited
impl Unsolicited
Sourcepub fn hold(&self, frame: Map<String, Value>)
pub fn hold(&self, frame: Map<String, Value>)
Parks a frame that no call was waiting for.
A poisoned lock is a frame not parked. It is dropped rather than reported because the caller is in the middle of a call and has no way to act on a queue fault; the alternative — panicking — would take the bridge down over a bookkeeping problem.
Sourcepub fn take(&self) -> Vec<Map<String, Value>>
pub fn take(&self) -> Vec<Map<String, Value>>
Takes everything held so far, leaving the queue empty.
Sourcepub fn wait(&self) -> impl Future<Output = ()> + Send + 'static
pub fn wait(&self) -> impl Future<Output = ()> + Send + 'static
Resolves once something has been parked here.
A queue that is already non-empty resolves on the first poll, which is
what stops a caller parking a frame between its own take and its first
poll from waiting for a wake-up that has already happened.
No #[must_use] here: the returned future is itself #[must_use], so
a second copy of the attribute adds nothing this signature does not
already say.