Function websocket_util::subscribe::drive
source · pub async fn drive<M, F, S>(
future: F,
stream: &mut S
) -> Result<F::Output, M::UserMessage>where
M: Message,
F: Future + Unpin,
S: FusedStream<Item = M::UserMessage> + Unpin,
Expand description
Helper function to drive a Subscription
related future to
completion. The function makes sure to poll the provided stream,
which is assumed to be associated with the Subscription
that the
future belongs to, so that control messages can be received. Errors
reported by the stream (identified via Message::is_error
) short
circuit and fail the operation immediately.