pub trait CapabilityKey: 'static {
type Capability: ?Sized + Send + Sync + 'static;
const NAME: &'static str;
}Expand description
The key trait for identifying capabilities in Kit.
Each capability is identified by a unique key type that implements this trait.
The Capability associated type specifies the trait object type of the capability.
The NAME constant provides a diagnostic name for error messages.
§Type Constraints
The Capability type must satisfy:
?Sized— allows trait objects likedyn SomeTraitSend + Sync + 'static— required for thread-safe storage in Kit
The key type itself must satisfy 'static for TypeId stability.
§Example
use trait_kit::core::capability::CapabilityKey;
struct MyKey;
impl CapabilityKey for MyKey {
type Capability = dyn Send + Sync;
const NAME: &'static str = "my_key";
}
let _ = MyKey::NAME;Required Associated Constants§
Required Associated Types§
Sourcetype Capability: ?Sized + Send + Sync + 'static
type Capability: ?Sized + Send + Sync + 'static
The capability trait object type.
Must satisfy ?Sized + Send + Sync + 'static.
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.