pub trait VirtualTcpListener:
VirtualIoSource
+ Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn try_accept(
&mut self,
) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>;
fn set_handler(
&mut self,
handler: Box<dyn InterestHandler + Send + Sync>,
) -> Result<()>;
fn addr_local(&self) -> Result<SocketAddr>;
fn set_ttl(&mut self, ttl: u8) -> Result<()>;
fn ttl(&self) -> Result<u8>;
}
Required Methods§
Sourcefn try_accept(
&mut self,
) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>
fn try_accept( &mut self, ) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>
Tries to accept a new connection
Sourcefn set_handler(
&mut self,
handler: Box<dyn InterestHandler + Send + Sync>,
) -> Result<()>
fn set_handler( &mut self, handler: Box<dyn InterestHandler + Send + Sync>, ) -> Result<()>
Registers a waker for when a new connection has arrived. This uses a stack machine which means more than one waker can be registered
Sourcefn addr_local(&self) -> Result<SocketAddr>
fn addr_local(&self) -> Result<SocketAddr>
Returns the local address of this TCP listener
Implementors§
impl VirtualTcpListener for CompositeTcpListener
impl VirtualTcpListener for LocalTcpListener
Available on crate feature
host-net
only.