pub trait WsMessageHandle<Msg, E> {
// Required methods
fn message_into_kind(msg: Msg) -> WsMessageKind;
fn error_into_kind(e: E) -> WsErrorKind;
fn message_from_bytes<T: Into<Vec<u8>>>(bytes: T) -> Msg;
// Provided method
fn wrap_stream<S>(inner: S) -> WsByteStream<S, Msg, E, Self>
where S: Stream<Item = Result<Msg, E>> + Sink<Msg, Error = E> + Unpin { ... }
}Expand description
Classify messages and errors of WebSocket.
Required Methods§
fn message_into_kind(msg: Msg) -> WsMessageKind
fn error_into_kind(e: E) -> WsErrorKind
Sourcefn message_from_bytes<T: Into<Vec<u8>>>(bytes: T) -> Msg
fn message_from_bytes<T: Into<Vec<u8>>>(bytes: T) -> Msg
These bytes will be carried by the Msg and sent by the underlying stream.
Provided Methods§
fn wrap_stream<S>(inner: S) -> WsByteStream<S, Msg, E, Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl WsMessageHandle<Message, WebSocketError> for stream_ws::gloo::WsMessageHandler
Available on crate feature
gloo only.impl WsMessageHandle<Message, Error> for stream_ws::tungstenite::WsMessageHandler
Available on crate feature
tungstenite only.