wick_config/traits.rs
1/// The [ExpandImports] trait is implemented by entities that may or may not need to alter the imported components.
2#[cfg(feature = "config")]
3pub trait ExpandImports {
4 /// The type of error that may be returned when expanding imports.
5 type Error;
6 /// Expand imports with any inline definitions.
7 fn expand_imports(
8 &mut self,
9 bindings: &mut Vec<crate::config::Binding<crate::config::ImportDefinition>>,
10 index: usize,
11 ) -> Result<(), Self::Error>;
12}
13
14/// The [Imports] trait is implemented by configuration that can import other configuration.
15#[cfg(feature = "config")]
16pub trait Imports {
17 /// Return a list of the imported configuration bindings.
18 fn imports(&self) -> &[crate::config::Binding<crate::config::ImportDefinition>];
19}
20
21/// The [RootConfig] trait is implemented by configurations that have root-level runtime configuration.
22#[cfg(feature = "config")]
23pub trait RootConfig {
24 /// Return the rendered [wick_packet::RuntimeConfig].
25 fn root_config(&self) -> Option<&wick_packet::RuntimeConfig>;
26
27 /// Set a rendered [wick_packet::RuntimeConfig].
28 fn set_root_config(&mut self, config: Option<wick_packet::RuntimeConfig>);
29}