Trait config::AsyncSource
source · [−]pub trait AsyncSource: Debug + Sync {
fn collect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ConfigError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn collect_to<'life0, 'life1, 'async_trait>(
&'life0 self,
cache: &'life1 mut Value
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
Describes a generic source of configuration properties capable of using an async runtime.
At the moment this library does not implement it, although it allows using its implementations within builders. Due to the scattered landscape of asynchronous runtimes, it is impossible to cater to all needs with one implementation. Also, this trait might be most useful with remote configuration sources, reachable via the network, probably using HTTP protocol. Numerous HTTP libraries exist, making it even harder to find one implementation that rules them all.
For those reasons, it is left to other crates to implement runtime-specific or proprietary details.
It is advised to use async_trait
crate while implementing this trait.
See examples for sample implementation.
Required Methods
Collects all configuration properties available from this source and return a Map as an async operations.
Provided Methods
fn collect_to<'life0, 'life1, 'async_trait>(
&'life0 self,
cache: &'life1 mut Value
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn collect_to<'life0, 'life1, 'async_trait>(
&'life0 self,
cache: &'life1 mut Value
) -> Pin<Box<dyn Future<Output = Result<(), ConfigError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Collects all configuration properties to a provided cache.