pub trait Listener:
Sized
+ Send
+ Sync {
type Accept: Send;
type Connection: Connection;
// Required methods
async fn accept(&self) -> Result<Self::Accept>;
async fn connect(&self, accept: Self::Accept) -> Result<Self::Connection>;
fn endpoint(&self) -> Result<Endpoint>;
}
Required Associated Types§
type Accept: Send
type Connection: Connection
Required Methods§
Sourceasync fn accept(&self) -> Result<Self::Accept>
Available on non-rust_analyzer
only.
async fn accept(&self) -> Result<Self::Accept>
rust_analyzer
only.§Future Bounds
The Future
generated by this async fn
must be Send
.
Sourceasync fn connect(&self, accept: Self::Accept) -> Result<Self::Connection>
Available on non-rust_analyzer
only.
async fn connect(&self, accept: Self::Accept) -> Result<Self::Connection>
rust_analyzer
only.§Future Bounds
The Future
generated by this async fn
must be Send
.
fn endpoint(&self) -> Result<Endpoint>
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.
Implementations on Foreign Types§
Source§impl<A: Listener, B: Listener> Listener for Either<A, B>
impl<A: Listener, B: Listener> Listener for Either<A, B>
type Accept = Either<<A as Listener>::Accept, <B as Listener>::Accept>
type Connection = Either<<A as Listener>::Connection, <B as Listener>::Connection>
Source§async fn connect(&self, accept: Self::Accept) -> Result<Self::Connection>
async fn connect(&self, accept: Self::Accept) -> Result<Self::Connection>
Available on non-
rust_analyzer
only.fn endpoint(&self) -> Result<Endpoint>
Source§impl<L: Listener> Listener for &L
impl<L: Listener> Listener for &L
Implementors§
impl Listener for DefaultListener
Source§impl Listener for TcpListener
impl Listener for TcpListener
type Accept = <TcpListener as Listener>::Connection
type Connection = TcpStream
Source§impl Listener for UnixListener
Available on Unix only.
impl Listener for UnixListener
Available on Unix only.
type Accept = UnixStream
type Connection = <UnixListener as Listener>::Accept
Source§impl<L> Listener for TlsListener<L>
Available on crate feature tls
only.
impl<L> Listener for TlsListener<L>
Available on crate feature
tls
only.