pub trait Server {
// Required method
fn serve<C, E>(
self,
executor: impl Executor + 'static,
error_handler: impl Fn(E) + Send + Sync + 'static,
connections: impl Stream<Item = Result<C, E>> + Unpin + Send + 'static,
endpoint: impl Endpoint + Sync + Clone + 'static,
) -> impl Future<Output = ()>
where C: Unpin + Send + AsyncRead + AsyncWrite + 'static,
E: Error;
}Expand description
Abstraction over HTTP server backends.
Required Methods§
Sourcefn serve<C, E>(
self,
executor: impl Executor + 'static,
error_handler: impl Fn(E) + Send + Sync + 'static,
connections: impl Stream<Item = Result<C, E>> + Unpin + Send + 'static,
endpoint: impl Endpoint + Sync + Clone + 'static,
) -> impl Future<Output = ()>
fn serve<C, E>( self, executor: impl Executor + 'static, error_handler: impl Fn(E) + Send + Sync + 'static, connections: impl Stream<Item = Result<C, E>> + Unpin + Send + 'static, endpoint: impl Endpoint + Sync + Clone + 'static, ) -> impl Future<Output = ()>
Serve an Endpoint over a stream of connections.
The provided executor runs background tasks created by the server while the error_handler
is used to report connection-accept errors surfaced by connections.
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.