Skip to main content

SharedTransport

Trait SharedTransport 

Source
pub trait SharedTransport:
    Stream<Item = Result<WsMessage, WsError>>
    + Unpin
    + Send
    + Sealed {
    type Attached: Send;

    // Required method
    fn take_attached(&mut self) -> Self::Attached;
}
Expand description

One stream’s view of a connection it shares with other streams: the raw frames carrying its own subscriptions, in the order the socket delivered them, and whatever the connection handed it on attaching.

Implemented by each sharing provider’s attachment, such as AlpacaAttachment. Sealed: only this crate’s providers share a connection.

Required Associated Types§

Source

type Attached: Send

What the connection hands a stream on attaching, for its transformer: () for a provider with nothing to hand over.

Required Methods§

Source

fn take_attached(&mut self) -> Self::Attached

Take what the connection handed the stream on attaching. Called once, before any frame is read.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SharedTransport for AlpacaAttachment

Alpaca hands a stream nothing on attaching.

Source§

impl SharedTransport for LseAttachment

A stream is handed what it needs to resume, if it resumes.

Source§

impl SharedTransport for MassiveAttachment

Massive hands a stream nothing on attaching.