config/provider.rs
1use crate::{Result, Settings};
2use tokens::{ChangeToken, NeverChangeToken};
3
4/// Defines the behavior of an object that provides configuration settings.
5pub trait Provider: Send + Sync {
6 /// Gets the name of the provider.
7 fn name(&self) -> &str;
8
9 /// Returns a [change token](ChangeToken) that indicates when this provider has changed.
10 fn reload_token(&self) -> Box<dyn ChangeToken> {
11 Box::new(NeverChangeToken)
12 }
13
14 /// Loads the provided configuration.
15 ///
16 /// # Arguments
17 ///
18 /// * `settings` - The [settings](Settings) to load the configured values into
19 fn load(&self, settings: &mut Settings) -> Result;
20}