Struct libpobsd::models::game::Game

source ·
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.

§tags: Option<Vec<String>>

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

source

pub fn new() -> Self

Create a new Game. Equivalent to Default.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn tags_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.

source

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.

source

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.

source

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.

source

pub fn get_steam_id(&self) -> Option<usize>

Returns the Steam id of a Game if it has any.

Trait Implementations§

source§

impl AsRef<Game> for Game

source§

fn as_ref(&self) -> &Game

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Game

source§

fn clone(&self) -> Game

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 Debug for Game

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Game

source§

fn default() -> Game

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

impl<'de> Deserialize<'de> for Game

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 Display for Game

Displays the game as it would appears in the database. See https://github.com/playonbsd/OpenBSD-Games-Database for details.

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Ord for Game

source§

fn cmp(&self, other: &Game) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Game

source§

fn eq(&self, other: &Game) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Game

source§

fn partial_cmp(&self, other: &Game) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &Game) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &Game) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

fn gt(&self, other: &Game) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

fn ge(&self, other: &Game) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Game

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
source§

impl Eq for Game

source§

impl StructuralPartialEq for Game

Auto Trait Implementations§

§

impl Freeze for Game

§

impl RefUnwindSafe for Game

§

impl Send for Game

§

impl Sync for Game

§

impl Unpin for Game

§

impl UnwindSafe for Game

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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>,