Skip to main content

WebSocketCallbackWithState

Trait WebSocketCallbackWithState 

Source
pub trait WebSocketCallbackWithState<State> {
    // Required method
    async fn run_with_state<R: Read, W: Write<Error = R::Error>>(
        self,
        state: &State,
        rx: SocketRx<R>,
        tx: SocketTx<W>,
    ) -> Result<(), W::Error>;
}
Available on crate feature ws only.
Expand description

A WebSocketCallback with access to the server state.

Required Methods§

Source

async fn run_with_state<R: Read, W: Write<Error = R::Error>>( self, state: &State, rx: SocketRx<R>, tx: SocketTx<W>, ) -> Result<(), W::Error>

Run the WebSocket connection, reading and writing to the socket.

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§