spin_expressions/provider.rs
1use std::fmt::Debug;
2
3use async_trait::async_trait;
4
5use crate::Key;
6
7/// A config provider.
8#[async_trait]
9pub trait Provider: Debug + Send + Sync {
10 /// Returns the value at the given config path, if it exists.
11 async fn get(&self, key: &Key) -> anyhow::Result<Option<String>>;
12
13 /// Returns true if the given key _might_ be resolvable by this Provider.
14 ///
15 /// Dynamic resolvers will typically return true unconditionally, which is
16 /// the default implementation.
17 fn may_resolve(&self, key: &Key) -> bool {
18 let _ = key;
19 true
20 }
21}