Struct libpobsd::db::database::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> 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,

§

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>,

§

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>,

§

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>,