Skip to main content

DataStore

Trait DataStore 

Source
pub trait DataStore: Send + Sync {
    // Required methods
    fn all_move_ids(
        &self,
        filter: &dyn Fn(&MoveData) -> bool,
    ) -> Result<Vec<Id>>;
    fn get_type_chart(&self) -> Result<TypeChart>;
    fn translate_alias(&self, id: &Id) -> Result<Option<Id>>;
    fn get_ability(&self, id: &Id) -> Result<Option<AbilityData>>;
    fn get_clause(&self, id: &Id) -> Result<Option<ClauseData>>;
    fn get_condition(&self, id: &Id) -> Result<Option<ConditionData>>;
    fn get_item(&self, id: &Id) -> Result<Option<ItemData>>;
    fn get_move(&self, id: &Id) -> Result<Option<MoveData>>;
    fn get_species(&self, id: &Id) -> Result<Option<SpeciesData>>;
}
Expand description

Collection of tables for all resource data.

This trait can be implemented for different data sources, such as an external database or disk.

This collection is used for “raw lookup” of resources by ID. Individual dexes may implement specialized lookup rules over this table, such as resolving aliases or special names.

Required Methods§

Source

fn all_move_ids(&self, filter: &dyn Fn(&MoveData) -> bool) -> Result<Vec<Id>>

Gets all move IDs, applying the given filter on the underlying data.

Source

fn get_type_chart(&self) -> Result<TypeChart>

Gets the type chart.

Source

fn translate_alias(&self, id: &Id) -> Result<Option<Id>>

Translates the given alias to another ID, if the alias mapping exists.

Source

fn get_ability(&self, id: &Id) -> Result<Option<AbilityData>>

Gets an ability by ID.

Source

fn get_clause(&self, id: &Id) -> Result<Option<ClauseData>>

Gets a clause by ID.

Source

fn get_condition(&self, id: &Id) -> Result<Option<ConditionData>>

Gets a condition by ID.

Source

fn get_item(&self, id: &Id) -> Result<Option<ItemData>>

Gets an item by ID.

Source

fn get_move(&self, id: &Id) -> Result<Option<MoveData>>

Gets a move by ID.

Source

fn get_species(&self, id: &Id) -> Result<Option<SpeciesData>>

Gets a species by ID.

Implementors§