TryMessageStreamExt

Trait TryMessageStreamExt 

Source
pub trait TryMessageStreamExt: Stream<Item = Result<Message, ReceiveMessageError>> {
    // Provided methods
    fn into_bytes_stream(
        self,
    ) -> impl Stream<Item = Result<Vec<u8>, ReceiveMessageError>>
       where Self: Sized { ... }
    fn into_string_stream(
        self,
    ) -> impl Stream<Item = Result<String, ReceiveDeserializedMessageError>>
       where Self: Sized { ... }
    fn into_deserialized_stream<T>(
        self,
        format: &MessageFormat,
    ) -> impl Stream<Item = Result<T, ReceiveDeserializedMessageError>>
       where T: for<'de> Deserialize<'de>,
             Self: Sized { ... }
    fn ignore_lost_messages(self) -> impl Stream<Item = Message>
       where Self: Sized { ... }
}
Expand description

Adapters for streams yielding Result<Message, ReceiveMessageError>.

Provided Methods§

Source

fn into_bytes_stream( self, ) -> impl Stream<Item = Result<Vec<u8>, ReceiveMessageError>>
where Self: Sized,

Convert stream’s messages into bytes.

Source

fn into_string_stream( self, ) -> impl Stream<Item = Result<String, ReceiveDeserializedMessageError>>
where Self: Sized,

Convert stream’s messages into strings. If the message cannot be deserialized from bytes, the ReceiveDeserializedMessageError::CannotDeserializeMessage error will be returned.

Source

fn into_deserialized_stream<T>( self, format: &MessageFormat, ) -> impl Stream<Item = Result<T, ReceiveDeserializedMessageError>>
where T: for<'de> Deserialize<'de>, Self: Sized,

Available on crate features json or message-pack only.

Convert stream’s messages into Rust types implementing Deserialize trait. If the message cannot be deserialized from bytes, the ReceiveDeserializedMessageError::CannotDeserializeMessage error will be returned.

Source

fn ignore_lost_messages(self) -> impl Stream<Item = Message>
where Self: Sized,

Ignore lost messages (see ProcessManagerHandle::subscribe_message_stream), returning a stream yielding Message types. The returned stream can be transformed further using MessageStreamExt trait.

Implementors§