Struct GameDataBase

Source
pub struct GameDataBase { /* private fields */ }
Expand description

Queryable representation of the PlayOnBSD database

Implementations§

Source§

impl GameDataBase

Source

pub fn new(games: Vec<Game>) -> Self

Create a database from a vector of games

Source

pub fn load_game(&mut self, game: Game)

Load game into the database

Source§

impl GameDataBase

Source

pub fn get_game_by_id(&self, game_id: u32) -> Option<&Game>

Returns the game with the given id.

Source

pub fn get_game_by_name( &self, name: &str, search_type: &SearchType, ) -> Option<&Game>

Returns the first game found which names contains the given name. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn get_game_by_steam_id(&self, steam_id: usize) -> Option<&Game>

Returns the game with the given steam_id.

Source

pub fn match_games_by_ids(&self, game_ids: Vec<u32>) -> QueryResult<&Game>

Returns all games matching the given vector of game ids.

Source

pub fn match_games_by_tag(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_year(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_engine(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_runtime(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_genre(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_dev(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn match_games_by_publi(&self, field: &str) -> QueryResult<&Game>

Returns the games for which the searched field exactly matches the given value.

Source

pub fn search_games_by_name( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_tag( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_year( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_engine( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_runtime( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_genre( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_dev( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_games_by_publi( &self, pattern: &str, search_type: &SearchType, ) -> QueryResult<&Game>

Returns the games for which the chosen field contains the given value. It can be case sensitive or insensitive depending on the SearchType variant.

Source

pub fn search_game_by_filter( &self, search_type: &SearchType, filter: &GameFilter, ) -> QueryResult<&Game>

Returns the games filtered using the GameFilter.

Source

pub fn get_all_games(&self) -> QueryResult<&Game>

Returns all games as a QueryResult.

Source

pub fn get_all_tags(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_engines(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_runtimes(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_genres(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_years(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_devs(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_publis(&self) -> QueryResult<&Item>

Returns all the items for the chosen field.

Source

pub fn get_all_tags_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_engines_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_runtimes_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_genres_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_years_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_devs_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Source

pub fn get_all_publis_with_ids(&self) -> Vec<(String, Vec<u32>)>

Returns all the items for the chosen field as well as the game ids associated to each item.

Trait Implementations§

Source§

impl Clone for GameDataBase

Source§

fn clone(&self) -> GameDataBase

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for GameDataBase

Source§

fn default() -> GameDataBase

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GameDataBase

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for GameDataBase

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,