pub async fn create_state(
    config: &Config
) -> Result<(State, impl Future<Output = Result<(), Error>>), Error>
Expand description

Initializes a State object by connecting to the various external services specified in config.

Returns the initialized State and a cleanup future. The cleanup future should be awaited only after dropping the State to check whether any errors occured while dropping the State. This awkward API is a workaround for the lack of AsyncDrop support in Rust.