1use crate::{Configuration, Merge, Result, Settings};
2use std::sync::Arc;
3use tokens::ChangeToken;
4
5pub struct Provider(Arc<Configuration>);
7
8impl Provider {
9 #[inline]
15 pub fn new(configuration: Arc<Configuration>) -> Self {
16 Self(configuration)
17 }
18}
19
20impl crate::Provider for Provider {
21 #[inline]
22 fn name(&self) -> &str {
23 "Chained"
24 }
25
26 #[inline]
27 fn reload_token(&self) -> Box<dyn ChangeToken> {
28 Box::new(self.0.change_token())
29 }
30
31 fn load(&self, settings: &mut Settings) -> Result {
32 settings.merge(&*self.0);
33 Ok(())
34 }
35}