Skip to main content

StatValueRegistry

Trait StatValueRegistry 

Source
pub trait StatValueRegistry:
    ErasedType
    + Send
    + Sync
    + 'static {
    // Required methods
    fn len(&self) -> usize;
    fn value_from_id(
        &self,
        id: usize,
    ) -> Option<&'static dyn StatValueRegistryEntry>;
    fn value_from_key(
        &self,
        key: &Identifier,
    ) -> Option<&'static dyn StatValueRegistryEntry>;

    // Provided methods
    fn key_from_id(&self, id: usize) -> Option<&'static Identifier> { ... }
    fn id_from_key(&self, key: &Identifier) -> Option<usize> { ... }
}
Expand description

Behavior required for a registry so that the values stored in that registry can be used for identifying a particular stat.

Required Methods§

Source

fn len(&self) -> usize

Source

fn value_from_id( &self, id: usize, ) -> Option<&'static dyn StatValueRegistryEntry>

Source

fn value_from_key( &self, key: &Identifier, ) -> Option<&'static dyn StatValueRegistryEntry>

Provided Methods§

Source

fn key_from_id(&self, id: usize) -> Option<&'static Identifier>

Source

fn id_from_key(&self, key: &Identifier) -> Option<usize>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§