Skip to main content

RepositoryItem

Trait RepositoryItem 

Source
pub trait RepositoryItem:
    Internal
    + Serialize
    + DeserializeOwned
    + Send
    + Sync
    + 'static {
    type Key: ToString + 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.

All repository items must implement Serialize and DeserializeOwned to support SDK-managed repositories that persist items to storage.

Required Associated Constants§

Source

const NAME: &'static str

The name of the type implementing this trait.

Required Associated Types§

Source

type Key: ToString + Send + Sync + 'static

The type used as a key in the Repository

Provided Methods§

Source

fn type_id() -> TypeId

Returns the TypeId of the type implementing this trait.

Source

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", so this trait is not object safe.

Implementors§