pub trait Transport: Sized + Send + Sync + Debug + 'static {
    type ConnectError: Send + Sync + Debug + Display;
    type IncomingError: Send + Sync + Debug + Display;
    type OutgoingError: Send + Sync + Debug + Display;
    type Incoming: FusedStream<Item = Result<IRCMessage, Either<Self::IncomingError, IRCParseError>>> + Unpin + Send + Sync;
    type Outgoing: Sink<IRCMessage, Error = Self::OutgoingError> + Unpin + Send + Sync;

    // Required methods
    fn new<'async_trait>(
    ) -> Pin<Box<dyn Future<Output = Result<Self, Self::ConnectError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn split(self) -> (Self::Incoming, Self::Outgoing);
}
Expand description

Abstracts over different ways of connecting to Twitch Chat, which are currently plain IRC (TCP), and the Twitch-specific WebSocket extension.

Required Associated Types§

source

type ConnectError: Send + Sync + Debug + Display

Error type for creating a new connection via new()

source

type IncomingError: Send + Sync + Debug + Display

Error type returned from the Self::Incoming stream type.

source

type OutgoingError: Send + Sync + Debug + Display

Error type returned from the Self::Outgoing sink type.

source

type Incoming: FusedStream<Item = Result<IRCMessage, Either<Self::IncomingError, IRCParseError>>> + Unpin + Send + Sync

Type of stream of incoming messages.

source

type Outgoing: Sink<IRCMessage, Error = Self::OutgoingError> + Unpin + Send + Sync

Type of outgoing messages sink.

Required Methods§

source

fn new<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<Self, Self::ConnectError>> + Send + 'async_trait>>where Self: 'async_trait,

Try to create and connect a new Transport of this type. Returns Ok(Self) after the connection was established successfully.

source

fn split(self) -> (Self::Incoming, Self::Outgoing)

Split this transport into its incoming and outgoing halves (streams).

Implementors§