Function gotham::bind_server
source · [−]pub async fn bind_server<'a, NH, F, Wrapped, Wrap>(
listener: TcpListener,
new_handler: NH,
wrap: Wrap
) -> !where
NH: NewHandler + 'static,
F: Future<Output = Result<Wrapped, ()>> + Unpin + Send + 'static,
Wrapped: Unpin + AsyncRead + AsyncWrite + Send + 'static,
Wrap: Fn(TcpStream) -> F,
Expand description
Returns a Future
used to spawn a Gotham application.
This is used internally, but it’s exposed for clients that want to set up their own TLS support. The wrap argument is a function that will receive a tokio-io TcpStream and should wrap the socket as necessary. Errors returned by this function will be ignored and the connection will be dropped if the future returned by the wrapper resolves to an error.