Skip to main content

build_server_fut

Function build_server_fut 

Source
pub fn build_server_fut(
    bind_addr: SocketAddr,
    router: Router<()>,
    layer_config: LayerConfig,
    maybe_tls_and_dns: Option<(Arc<ServerConfig>, &str)>,
    server_span_name: &str,
    server_span: Span,
    shutdown: NotifyOnce,
) -> Result<(impl Future<Output = ()>, String)>
Expand description

Constructs an API server future which can be spawned into a task. Additionally returns the server url.

Use this helper when it is useful to poll multiple futures in a single task to reduce the amount of task nesting / indirection. If there is only one future that needs to be driven, use spawn_server_task instead.

Errors if the TcpListener failed to bind or return its local address. Returns the server future along with the bound socket address.