pub trait Acceptor<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>:
Send
+ Sync
+ 'static {
// Required methods
fn accept<'life0, 'async_trait>(
&'life0 self,
stream: S,
local_addr: SocketAddr,
remote_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn protocol(&self) -> Protocol;
}
Expand description
A trait for defining links server acceptors.
For more info about acceptors in general, please see the module-level documentation.
Required Methods§
Sourcefn accept<'life0, 'async_trait>(
&'life0 self,
stream: S,
local_addr: SocketAddr,
remote_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept<'life0, 'async_trait>(
&'life0 self,
stream: S,
local_addr: SocketAddr,
remote_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accept an incoming connection in stream
from remote_addr
to
local_addr
. This function should spawn a task to handle the
request using this acceptor’s associated handler.