pub trait RepositoryItem: Internal + Persist {
type Key: ToString + FromStr + Send + Sync + 'static;
const NAME: &'static str;
// Provided methods
fn type_id() -> TypeId { ... }
fn data() -> RepositoryItemData { ... }
}Expand description
This trait is used to mark types that can be stored in a repository. It should not be implemented manually; instead, users should use the crate::register_repository_item macro to register their item types.
The Persist bound is what makes an item storable by SDK-managed repositories. It is
satisfied automatically by any type that is serializable and thread-safe.
Required Associated Constants§
Required Associated Types§
Sourcetype Key: ToString + FromStr + Send + Sync + 'static
type Key: ToString + FromStr + Send + Sync + 'static
The type used as a key in the Repository.
FromStr is required so the debug-capabilities surface can address items
by a string key; every current key type (String and the uuid_newtype!
ids) already implements it, so this bound is satisfied everywhere.
Provided Methods§
Sourcefn data() -> RepositoryItemData
fn data() -> RepositoryItemData
Returns metadata about the repository item type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".