pub struct Game {Show 18 fields
pub uid: u32,
pub name: String,
pub cover: Option<String>,
pub engine: Option<String>,
pub setup: Option<String>,
pub runtime: Option<String>,
pub stores: Option<StoreLinks>,
pub hints: Option<String>,
pub genres: Option<Vec<String>>,
pub tags: Option<Vec<String>>,
pub year: Option<String>,
pub devs: Option<Vec<String>>,
pub publis: Option<Vec<String>>,
pub version: Option<String>,
pub status: GameStatus,
pub added: NaiveDate,
pub updated: NaiveDate,
pub igdb_id: Option<String>,
}
Expand description
Representation of a game of the PlayOnBSD database.
It also includes an additional Game::uid
field
derived from the name of the game as well as the date to
which the game was added to the database. It therefore
provides an unique identifier under the assumption that no
game with the same name will be added the same date into
the database.
The name of some fields differs from the one used in the database itself: Genre and Store are plural since there can be more than one item for each and Pub translate to publi since pub is a reserved keyword in Rust.
§Display
The Game
struct implement the core::fmt::Display
trait
and will be displayed as it would appear in the
PlayOnBSD database.
§PartialOrd
The Game
struct implements the core::cmp::PartialOrd
trait
and Game
objects are ordered according to their name (without The or A).
Fields§
§uid: u32
Unique identifier generated from the name and added fields
name: String
Name of the game.
cover: Option<String>
Cover of the game.
engine: Option<String>
Engine used by the game.
setup: Option<String>
Step(s) to setup the game.
runtime: Option<String>
Executable in the package.
stores: Option<StoreLinks>
Vector with store urls.
hints: Option<String>
Hints (as the name imply).
genres: Option<Vec<String>>
Vector of genres associated with the game.
Vector of tags associated with the game.
year: Option<String>
Released year (can be text such as “early access”.
devs: Option<Vec<String>>
Developer.
publis: Option<Vec<String>>
Publisher.
version: Option<String>
Version of the game.
status: GameStatus
When tested on -current.
added: NaiveDate
When added
updated: NaiveDate
When updated
igdb_id: Option<String>
IGDB Id of the game
Implementations§
source§impl<'a> Game
impl<'a> Game
sourcepub fn name_contains(&self, pattern: &str, search_type: &SearchType) -> bool
pub fn name_contains(&self, pattern: &str, search_type: &SearchType) -> bool
Returns true if the name field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn engine_contains(&self, pattern: &str, search_type: &SearchType) -> bool
pub fn engine_contains(&self, pattern: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn runtime_contains(&self, pattern: &str, search_type: &SearchType) -> bool
pub fn runtime_contains(&self, pattern: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn year_contains(&self, pattern: &str, search_type: &SearchType) -> bool
pub fn year_contains(&self, pattern: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn genres_contains(&self, value: &str, search_type: &SearchType) -> bool
pub fn genres_contains(&self, value: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn devs_contains(&self, value: &str, search_type: &SearchType) -> bool
pub fn devs_contains(&self, value: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn publis_contains(&self, value: &str, search_type: &SearchType) -> bool
pub fn publis_contains(&self, value: &str, search_type: &SearchType) -> bool
Returns true if the chosen field of a Game
contains the given pattern, false otherwise.
The search can be case sensitive or not depending on the SearchType
variant.
sourcepub fn status_is(&self, status: &impl AsRef<Status>) -> bool
pub fn status_is(&self, status: &impl AsRef<Status>) -> bool
Return true if the Status
of the Game
correspond to a given Status
,
false otherwise. Note that the argument provided can be Status
or
crate::models::GameStatus
.
sourcepub fn get_steam_id(&self) -> Option<usize>
pub fn get_steam_id(&self) -> Option<usize>
Returns the Steam id of a Game
if it has any.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Game
impl<'de> Deserialize<'de> for Game
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for Game
impl Display for Game
Displays the game as it would appears in the database. See https://github.com/playonbsd/OpenBSD-Games-Database for details.