pub trait Server: Sized + Send {
type Socket: Socket;
// Required methods
fn bind(
options: &ServerOptions,
) -> impl Future<Output = Result<Self>> + Send;
fn accept(
&mut self,
) -> impl Future<Output = Option<(Self::Socket, SocketAddr)>> + Send;
fn local_addr(&self) -> Result<SocketAddr>;
// Provided method
fn start(
options: ServerOptions,
service: Service<Handler>,
statistics: Statistics,
exchanger: Exchanger,
) -> impl Future<Output = Result<()>> + Send { ... }
}Required Associated Types§
Required Methods§
Sourcefn bind(options: &ServerOptions) -> impl Future<Output = Result<Self>> + Send
fn bind(options: &ServerOptions) -> impl Future<Output = Result<Self>> + Send
Bind the server to the specified address.
Sourcefn accept(
&mut self,
) -> impl Future<Output = Option<(Self::Socket, SocketAddr)>> + Send
fn accept( &mut self, ) -> impl Future<Output = Option<(Self::Socket, SocketAddr)>> + Send
Accept a new connection.
Sourcefn local_addr(&self) -> Result<SocketAddr>
fn local_addr(&self) -> Result<SocketAddr>
Get the local address of the listener.
Provided Methods§
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.