pub trait ServerTransport: Send + Sync {
// Required methods
fn address(&self) -> &ServerAddress;
fn accept(&self, cx: &mut Cx) -> Result<Box<dyn ConnectionTransport>>;
fn shutdown(&self, cx: &mut Cx) -> Result<()>;
fn accept_timeout(
&self,
cx: &mut Cx,
timeout: Duration,
) -> Result<Option<Box<dyn ConnectionTransport>>>;
}Expand description
Listening side of a transport: binds an address and accepts connections.
Required Methods§
Sourcefn address(&self) -> &ServerAddress
fn address(&self) -> &ServerAddress
Returns the address this transport is bound to.
Sourcefn accept(&self, cx: &mut Cx) -> Result<Box<dyn ConnectionTransport>>
fn accept(&self, cx: &mut Cx) -> Result<Box<dyn ConnectionTransport>>
Blocks until a connection arrives and returns it.
Sourcefn shutdown(&self, cx: &mut Cx) -> Result<()>
fn shutdown(&self, cx: &mut Cx) -> Result<()>
Shuts down the listener and releases its resources.
Sourcefn accept_timeout(
&self,
cx: &mut Cx,
timeout: Duration,
) -> Result<Option<Box<dyn ConnectionTransport>>>
fn accept_timeout( &self, cx: &mut Cx, timeout: Duration, ) -> Result<Option<Box<dyn ConnectionTransport>>>
Accepts a connection, returning None if timeout elapses first.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".