pub trait ConfigKey: 'static {
type Config: Send + Sync + 'static;
const NAME: &'static str;
}Expand description
The key trait for identifying configuration in Kit.
Each configuration is identified by a unique key type that implements this trait.
The Config associated type specifies the configuration value type.
The NAME constant provides a diagnostic name for error messages.
§Type Constraints
The Config type must satisfy Send + Sync + 'static for thread-safe storage.
Note: Config must be Sized (no ?Sized bound) because ArcSwap<T> requires T: Sized.
The key type itself must satisfy 'static for TypeId stability.
§Example
use trait_kit::core::config::ConfigKey;
struct MyConfig;
impl ConfigKey for MyConfig {
type Config = i32;
const NAME: &'static str = "my_config";
}
assert_eq!(MyConfig::NAME, "my_config");Required Associated Constants§
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.