pub trait KonfigSection: KonfigSerialization {
// Required method
fn name(&self) -> Cow<'_, str>;
// Provided methods
fn validate(&self) -> Result<(), KonfigError> { ... }
fn on_load(&self) -> Result<(), KonfigError> { ... }
}
Expand description
This is the trait allowing a struct to be registered as a section and managed by KonfigManager
You can use the shorthand #[derive(KonfigSection)]
macro to implement automatically implement it using defaults
If you want to use custom validate or on_load callbacks, you have to implement this trait manually, there are plans to allow for adding custom callbacks using the derive macro or with a functional interface