Function server_main

Source
pub fn server_main<Opts, ServerFuture, ServerConstructor>(
    server_constructor: ServerConstructor,
) -> i32
where Opts: Parser + BearingConfigFilePath, ServerFuture: Future<Output = Result<(), Box<dyn Error + 'static>>> + 'static, ServerConstructor: FnOnce(Config, AuthToken, Opts, Pin<Box<dyn Future<Output = ()> + Send + 'static>>) -> ServerFuture,
Expand description

Handles boilerplate setup for:

  • tracing_subscriber configuration
  • Signal pipe fixup
  • Printing out errors
  • Exit code management

The server constructor function consumes config, custom cli args, and a shutdown signal future, then returns an indefinitely-running future that represents the server.

This function blocks waiting for either the constructed server future to finish or a CTRL+C style signal.

Returns the process’s desired exit code.