pub trait ConfigItem:
DeserializeOwned
+ Clone
+ Send
+ Sync
+ 'static {
// Required method
fn toml_key() -> &'static str;
// Provided method
fn register(state: &State, config: &Config) { ... }
}Expand description
Trait for configuration section types.
Types implementing this trait can be used with Config::get() to extract
and deserialize specific sections from the configuration table.
Use the #[config(key = "section_name")] macro to automatically implement this trait.
The macro will also auto-register the config type using the inventory crate.
ⓘ
use sword::prelude::*;
#[config(key = "my_section")]
struct MyConfig {
value: String,
}Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".