1use std::path::Path;
2
3use serde::Deserialize;
4
5use crate::*;
6
7#[derive(Default, Deserialize)]
8#[cfg_attr(feature = "test-utils", derive(serde::Serialize))]
9pub struct Config {
10 pub creation_rules: Vec<CreationRule>,
11}
12
13impl Config {
14 pub fn retrieve(optional_config_path: Option<&Path>) -> anyhow::Result<Self> {
15 super::retrieve::retrieve_impl::<Self>(optional_config_path)
16 }
17}
18
19#[cfg(feature = "test-utils")]
20mod mock {
21 use rops::test_utils::*;
22
23 use super::*;
24
25 impl MockTestUtil for Config {
26 fn mock() -> Self {
27 Self {
28 creation_rules: vec![MockTestUtil::mock()],
29 }
30 }
31 }
32
33 impl MockOtherTestUtil for Config {
34 fn mock_other() -> Self {
35 Self {
36 creation_rules: vec![MockOtherTestUtil::mock_other()],
37 }
38 }
39 }
40}