pub struct Subscription<S, M, I>where
M: Message,{ /* private fields */ }
Expand description
A subscription associated with a MessageStream
that allows for
sending and receiving control messages over it.
§Notes
- in order for any
send
orread
operations to resolve, the associatedMessageStream
stream needs to be polled; that is necessary because this operation expects a control message response and that control message comes through the regular stream.
Implementations§
Source§impl<S, M, I> Subscription<S, M, I>
impl<S, M, I> Subscription<S, M, I>
Sourcepub async fn send(
&mut self,
item: I,
) -> Result<Option<Result<M::ControlMessage, ()>>, S::Error>
pub async fn send( &mut self, item: I, ) -> Result<Option<Result<M::ControlMessage, ()>>, S::Error>
Send a message over the internal control channel and wait a control message response.
The method returns the following errors:
Err(..)
when the sink failed to send an itemOk(None)
when the message stream got closedOk(Some(Err(())))
when message classification reported an error; the actual error still manifests through the message stream
Trait Implementations§
Auto Trait Implementations§
impl<S, M, I> Freeze for Subscription<S, M, I>where
S: Freeze,
impl<S, M, I> RefUnwindSafe for Subscription<S, M, I>where
S: RefUnwindSafe,
I: RefUnwindSafe,
impl<S, M, I> Send for Subscription<S, M, I>
impl<S, M, I> Sync for Subscription<S, M, I>
impl<S, M, I> Unpin for Subscription<S, M, I>
impl<S, M, I> UnwindSafe for Subscription<S, M, I>where
S: UnwindSafe,
I: UnwindSafe,
Blanket Implementations§
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