zen_engine/loader/
noop.rs

1use crate::loader::{DecisionLoader, LoaderError, LoaderResponse};
2use anyhow::anyhow;
3use std::future::Future;
4use std::pin::Pin;
5
6/// Default loader which always fails
7#[derive(Default, Debug)]
8pub struct NoopLoader;
9
10impl DecisionLoader for NoopLoader {
11    fn load<'a>(
12        &'a self,
13        key: &'a str,
14    ) -> Pin<Box<dyn Future<Output = LoaderResponse> + 'a + Send>> {
15        Box::pin(async move {
16            Err(LoaderError::Internal {
17                key: key.to_string(),
18                source: anyhow!("Loader is no-op"),
19            }
20            .into())
21        })
22    }
23}