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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.