Trait ConfigSource

Source
pub trait ConfigSource: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConfigValue>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &str;

    // Provided methods
    fn supports_watching(&self) -> bool { ... }
    fn start_watching<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Receiver<ConfigValue>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for configuration sources

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConfigValue>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load configuration from this source

Source

fn name(&self) -> &str

Get the name of this source (for debugging/logging)

Provided Methods§

Source

fn supports_watching(&self) -> bool

Check if this source supports watching for changes

Source

fn start_watching<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Receiver<ConfigValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start watching for changes (if supported)

Implementors§