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§
Sourcefn all_move_ids(&self, filter: &dyn Fn(&MoveData) -> bool) -> Result<Vec<Id>>
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.
Sourcefn get_type_chart(&self) -> Result<TypeChart>
fn get_type_chart(&self) -> Result<TypeChart>
Gets the type chart.
Sourcefn translate_alias(&self, id: &Id) -> Result<Option<Id>>
fn translate_alias(&self, id: &Id) -> Result<Option<Id>>
Translates the given alias to another ID, if the alias mapping exists.
Sourcefn get_ability(&self, id: &Id) -> Result<Option<AbilityData>>
fn get_ability(&self, id: &Id) -> Result<Option<AbilityData>>
Gets an ability by ID.
Sourcefn get_clause(&self, id: &Id) -> Result<Option<ClauseData>>
fn get_clause(&self, id: &Id) -> Result<Option<ClauseData>>
Gets a clause by ID.
Sourcefn get_condition(&self, id: &Id) -> Result<Option<ConditionData>>
fn get_condition(&self, id: &Id) -> Result<Option<ConditionData>>
Gets a condition by ID.
Sourcefn get_species(&self, id: &Id) -> Result<Option<SpeciesData>>
fn get_species(&self, id: &Id) -> Result<Option<SpeciesData>>
Gets a species by ID.