Trait salvo_core::conn::Listener

source ·
pub trait Listener {
    type Acceptor: Acceptor;

    // Required method
    fn try_bind(self) -> impl Future<Output = Result<Self::Acceptor>> + Send;

    // Provided methods
    fn bind(self) -> impl Future<Output = Self::Acceptor> + Send
       where Self: Sized + Send { ... }
    fn join<T>(self, other: T) -> JoinedListener<Self, T>
       where Self: Sized + Send { ... }
}
Expand description

Listener represents a listener that can bind to a specific address and port and return an acceptor.

Required Associated Types§

source

type Acceptor: Acceptor

Acceptor type.

Required Methods§

source

fn try_bind(self) -> impl Future<Output = Result<Self::Acceptor>> + Send

Bind and returns acceptor.

Provided Methods§

source

fn bind(self) -> impl Future<Output = Self::Acceptor> + Send
where Self: Sized + Send,

Bind and returns acceptor.

source

fn join<T>(self, other: T) -> JoinedListener<Self, T>
where Self: Sized + Send,

Join current Listener with the other.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<A, B> Listener for JoinedListener<A, B>
where A: Listener + Send + Unpin + 'static, B: Listener + Send + Unpin + 'static, A::Acceptor: Acceptor + Send + Unpin + 'static, B::Acceptor: Acceptor + Send + Unpin + 'static,

§

type Acceptor = JoinedAcceptor<<A as Listener>::Acceptor, <B as Listener>::Acceptor>

source§

impl<S, C, T, E> Listener for NativeTlsListener<S, C, T, E>
where S: IntoConfigStream<C> + Send + 'static, C: TryInto<Identity, Error = E> + Send + 'static, T: Listener + Send, T::Acceptor: Send + 'static, E: StdError + Send,

Available on crate feature native-tls only.
§

type Acceptor = NativeTlsAcceptor<Pin<Box<dyn Stream<Item = C> + Send>>, C, <T as Listener>::Acceptor, E>

source§

impl<S, C, T, E> Listener for OpensslListener<S, C, T, E>
where S: IntoConfigStream<C> + Send + 'static, C: TryInto<SslAcceptorBuilder, Error = E> + Send + 'static, T: Listener + Send, T::Acceptor: Send + 'static, E: StdError + Send,

Available on crate feature openssl only.
§

type Acceptor = OpensslAcceptor<Pin<Box<dyn Stream<Item = C> + Send>>, C, <T as Listener>::Acceptor, E>

source§

impl<S, C, T, E> Listener for QuinnListener<S, C, T, E>
where S: IntoConfigStream<C> + Send + 'static, C: TryInto<ServerConfig, Error = E> + Send + 'static, T: ToSocketAddrs + Send, E: StdError + Send,

Available on crate feature quinn only.
§

type Acceptor = QuinnAcceptor<Pin<Box<dyn Stream<Item = C> + Send>>, C, <C as TryInto<ServerConfig>>::Error>

source§

impl<S, C, T, E> Listener for RustlsListener<S, C, T, E>
where S: IntoConfigStream<C> + Send + 'static, C: TryInto<ServerConfig, Error = E> + Send + 'static, T: Listener + Send, T::Acceptor: Send + 'static, E: StdError + Send,

Available on crate feature rustls only.
§

type Acceptor = RustlsAcceptor<Pin<Box<dyn Stream<Item = C> + Send>>, C, <T as Listener>::Acceptor, E>

source§

impl<T> Listener for AcmeListener<T>
where T: Listener + Send, T::Acceptor: Send + 'static,

Available on crate feature acme only.
§

type Acceptor = AcmeAcceptor<<T as Listener>::Acceptor>

source§

impl<T> Listener for TcpListener<T>
where T: ToSocketAddrs + Send,

source§

impl<T> Listener for UnixListener<T>
where T: AsRef<Path> + Send + Clone,

Available on Unix only.