karyon_net::listener

Trait ConnListener

Source
pub trait ConnListener: Send + Sync {
    type Message;
    type Error;

    // Required methods
    fn local_endpoint(&self) -> Result<Endpoint, Self::Error>;
    fn accept<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Conn<Self::Message, Self::Error>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

ConnListener is a generic network listener interface for [tcp::TcpConn], [tls::TlsConn], [ws::WsConn], and [unix::UnixConn].

Required Associated Types§

Required Methods§

Source

fn local_endpoint(&self) -> Result<Endpoint, Self::Error>

Source

fn accept<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Conn<Self::Message, Self::Error>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trait Implementations§

Source§

impl<C, E> From<TcpListener<C>> for Box<dyn ConnListener<Message = C::Message, Error = E>>
where C: Clone + Codec<Error = E> + 'static, E: From<Error>,

Source§

fn from(listener: TcpListener<C>) -> Self

Converts to this type from the input type.

Implementors§

Source§

impl<C, E> ConnListener for TcpListener<C>
where C: Codec<Error = E> + Clone + 'static, E: From<Error>,

Source§

impl<C, E> ConnListener for TlsListener<C>
where C: Clone + Codec<Error = E> + 'static, E: From<Error>,

Source§

impl<C, E> ConnListener for UnixListener<C>
where C: Codec<Error = E> + Clone + 'static, E: From<Error>,

Source§

impl<C, E> ConnListener for WsListener<C>
where C: WebSocketCodec<Error = E> + Clone + 'static, E: From<Error> + From<Error>,