Trait WebSocketContext

Source
pub trait WebSocketContext:
    Stream<Item = WebSocketStreamResult<Next<Self::Incoming, Self::Outgoing, Self::Responder>>>
    + WebSocketErrorResponder
    + Sized {
    type Options: IntoWebSocketContext<Self>;
    type Incoming: CommunicableType;
    type Outgoing: CommunicableType + From<GenericWebSocketError>;
    type Responder;

    // Required methods
    fn handle_incoming(
        &mut self,
        incoming: Communication<Self::Incoming>,
    ) -> impl Future<Output = Result<(), WebSocketError>> + Send;
    fn handle_outgoing(
        &mut self,
        outgoing: WebSocketItem<Communication<Self::Outgoing>, Self::Responder>,
    ) -> impl Future<Output = Result<(), WebSocketError>> + Send;

    // Provided method
    fn with_options(
        options: Self::Options,
        channel: <Self::Options as IntoWebSocketContext<Self>>::Channel,
    ) -> Self { ... }
}

Required Associated Types§

Source

type Options: IntoWebSocketContext<Self>

Source

type Incoming: CommunicableType

Source

type Outgoing: CommunicableType + From<GenericWebSocketError>

Source

type Responder

Required Methods§

Source

fn handle_incoming( &mut self, incoming: Communication<Self::Incoming>, ) -> impl Future<Output = Result<(), WebSocketError>> + Send

Source

fn handle_outgoing( &mut self, outgoing: WebSocketItem<Communication<Self::Outgoing>, Self::Responder>, ) -> impl Future<Output = Result<(), WebSocketError>> + Send

Provided Methods§

Source

fn with_options( options: Self::Options, channel: <Self::Options as IntoWebSocketContext<Self>>::Channel, ) -> 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§

Source§

impl<Incoming, Outgoing> WebSocketContext for LocalServerContext<Incoming, Outgoing>
where Incoming: CommunicableType + Send, Outgoing: CommunicableType + From<GenericWebSocketError> + Send,

Source§

type Options = ServerOptions<UnixStream, Incoming, Outgoing, ()>

Source§

type Incoming = Incoming

Source§

type Outgoing = Outgoing

Source§

type Responder = ()

Source§

impl<Incoming, Outgoing> WebSocketContext for RemoteServerContext<Incoming, Outgoing>
where Incoming: CommunicableType + Send, Outgoing: CommunicableType + From<GenericWebSocketError> + Send,