pub trait TransportListener: Send + Sync {
type Transport: Transport;
type Error: Error + Send + Sync + 'static;
// Required methods
fn accept(
&self,
) -> impl Future<Output = Result<Self::Transport, Self::Error>> + Send;
fn local_addr(&self) -> Option<String>;
}Expand description
Listener trait for server-side transports.
Transport listeners accept incoming connections and produce transport instances for each connection.
Implementations include WebSocketListener
and UnixListener (Unix only).
Required Associated Types§
Required Methods§
Sourcefn accept(
&self,
) -> impl Future<Output = Result<Self::Transport, Self::Error>> + Send
fn accept( &self, ) -> impl Future<Output = Result<Self::Transport, Self::Error>> + Send
Accept an incoming connection.
This method blocks until a new connection is available.
§Errors
Returns an error if accepting the connection failed.
Sourcefn local_addr(&self) -> Option<String>
fn local_addr(&self) -> Option<String>
Get the local address the listener is bound to, if available.
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.