pub trait MessageStreamExt: Stream<Item = Message> {
// Provided methods
fn into_bytes_stream(self) -> impl Stream<Item = Vec<u8>>
where Self: Sized { ... }
fn into_string_stream(
self,
) -> impl Stream<Item = Result<String, FromUtf8Error>>
where Self: Sized { ... }
fn into_deserialized_stream<T>(
self,
format: &MessageFormat,
) -> impl Stream<Item = Result<T, SerdeError>>
where T: for<'de> Deserialize<'de>,
Self: Sized { ... }
}
Expand description
Adapters specific to Message
-returning streams.
Provided Methods§
Sourcefn into_bytes_stream(self) -> impl Stream<Item = Vec<u8>>where
Self: Sized,
fn into_bytes_stream(self) -> impl Stream<Item = Vec<u8>>where
Self: Sized,
Convert stream’s messages into bytes.
Sourcefn into_string_stream(self) -> impl Stream<Item = Result<String, FromUtf8Error>>where
Self: Sized,
fn into_string_stream(self) -> impl Stream<Item = Result<String, FromUtf8Error>>where
Self: Sized,
Convert stream’s messages into strings.
If the message cannot be deserialized from bytes, the FromUtf8Error
error will be returned.
Sourcefn into_deserialized_stream<T>(
self,
format: &MessageFormat,
) -> impl Stream<Item = Result<T, SerdeError>>where
T: for<'de> Deserialize<'de>,
Self: Sized,
Available on crate features json
or message-pack
only.
fn into_deserialized_stream<T>(
self,
format: &MessageFormat,
) -> impl Stream<Item = Result<T, SerdeError>>where
T: for<'de> Deserialize<'de>,
Self: Sized,
json
or message-pack
only.Convert stream’s messages into Rust
types implementing Deserialize
trait.
If the message cannot be deserialized from bytes, the SerdeError::DeserializationFailure
error will be returned.