Struct pobsd_parser::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 dev: Option<String>, pub publi: Option<String>, pub version: Option<String>, pub status: Option<String>, pub added: Option<String>, pub updated: Option<String>, pub igdb_id: Option<String>,
}
Expand description

Represents a game from the 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 dat into the databas.

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.

All fields are optional strings or vectors of strings except for the name of the game which is mandatory. The parser does not try to be smart with dates and just store them as string.

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

An unique identifier generated from the name and added fields

§name: String

The name of the game.

§cover: Option<String>

The cover of the game.

§engine: Option<String>

The engine used by the game.

§setup: Option<String>

Step(s) to setup the game.

§runtime: Option<String>

The executable in the package.

§stores: Option<StoreLinks>

A vector with store urls.

§hints: Option<String>

Hints (as the name imply).

§genres: Option<Vec<String>>

A vector of genres associated with the game.

§tags: Option<Vec<String>>

A vector of tags associated with the game.

§year: Option<String>

Released year (can be text such as “early access”.

§dev: Option<String>

Developer.

§publi: Option<String>

Publisher.

§version: Option<String>

Version of the game.

§status: Option<String>

When tested on -current.

§added: Option<String>

When added

§updated: Option<String>

When updated

§igdb_id: Option<String>

The IGDB Id of the game

Implementations§

source§

impl<'a> Game

source

pub fn new() -> Self

Trait Implementations§

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

Display 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) -> Selfwhere Self: Sized,

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

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

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

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

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

impl PartialEq<Game> 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<Game> 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 StructuralEq for Game

source§

impl StructuralPartialEq for Game

Auto Trait Implementations§

§

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 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> ToOwned for Twhere 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 Twhere 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 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.