use async_trait::async_trait;
#[async_trait]
pub trait ConfigProvider: Send + Sync {
async fn load(&self) -> Result<String, String>; }
#[async_trait]
pub trait ConfigWatcher: Send + Sync {
async fn subscribe(&self) -> Result<ConfigStream, String>;
}
pub struct ConfigStream;
impl ConfigStream {
pub async fn next(&mut self) -> Option<String> {
None
}
}
pub struct NoopConfigProvider;
#[async_trait]
impl ConfigProvider for NoopConfigProvider {
async fn load(&self) -> Result<String, String> {
Ok(String::new())
}
}
pub struct NoopConfigWatcher;
#[async_trait]
impl ConfigWatcher for NoopConfigWatcher {
async fn subscribe(&self) -> Result<ConfigStream, String> {
Ok(ConfigStream)
}
}