WsConnect

Trait WsConnect 

Source
pub trait WsConnect {
    type Stream;
    type Sink;

    // Required method
    fn connect(
        &mut self,
        ws_url: Url,
    ) -> impl Future<Output = Result<(Self::Sink, Self::Stream)>> + Send + Sync;
}
Expand description

The WsConnect trait allows for connecting to a websocket.

Implementors of the WsConnect trait are called ‘connectors’.

Connectors are defined by one method, connect(). A call to connect() attempts to establish a secure websocket connection and return an asynchronous stream of [Message]s wrapped in a Result.

Required Associated Types§

Source

type Stream

An associated Stream of [Message]s wrapped in a Result that this connection returns.

Source

type Sink

An associated Sink of [Message]s that this connection sends.

Required Methods§

Source

fn connect( &mut self, ws_url: Url, ) -> impl Future<Output = Result<(Self::Sink, Self::Stream)>> + Send + Sync

Asynchronously connects to a websocket hosted on ws_url.

See the WsConnect documentation for details.

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§