Skip to main content

install_default

Function install_default 

Source
pub fn install_default()
Expand description

Install the process-wide defaults provided by the facade crate.

The first call runs init_default_registry, installs the Tokio executor if executors-tokio is enabled, then installs the reqwest transport and registers the http context factory if a http-transport-reqwest* feature is enabled. Later calls leave the installed defaults and factories in place.

The first installed executor and the first installed HTTP transport each stay in effect as process-wide defaults. Applications that supply their own can disable auto-register-services and install them first with Executor::install_default and HttpTransporter::install_default. They can then call this function to install the remaining facade defaults, or call init_default_registry for services and layers alone.

Registration of the reqwest http context factory replaces an earlier factory of the same name, even if a custom process-wide transport is already installed. To keep a custom http context factory, use OperatorRegistry::register_context after the first call. To replace runtime resources on one operator, use Operator::with_context.

When auto-register-services is enabled, a process constructor calls this function before main. If the constructor is disabled or unavailable, call it explicitly to make these defaults available before constructing operators with Operator::from_uri or Operator::via_iter.