Struct GameDataBase

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

Representation of the PlayOnBSD database that provides a set of methods to query and filter the games.

Implementations§

Source§

impl GameDataBase

Source

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

Create a database for the given vector of games

Source

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

Load the given game in the database

Source§

impl GameDataBase

Source

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

Return all the games of the database

Source

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

Return the game with a given id

Source

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

Return the game with the given ids

Source

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

Return the game with the given name (case sensitive)

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the games having the chosen field equal to the given value

Source

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

Return the game with the given steam_id (case sensitive)

Source

pub fn search_game_by_name(&self, name: &str) -> QueryResult<&Game>

Return the games having the name containing the given value (not case sensitive)

Source

pub fn search_game_by_year(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_engine(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_runtime(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_dev(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_publi(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_genres(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

pub fn search_game_by_tags(&self, name: &str) -> QueryResult<&Game>

Return the games having the given field containing the given value (not case sensitive)

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Source

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

Return all the chosen items of the database

Trait Implementations§

Source§

impl Default for GameDataBase

Source§

fn default() -> GameDataBase

Returns the “default value” for a type. 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, 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.