moduforge_rules_engine/loader/
noop.rs

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