Trait GameObjectMapping

Source
pub trait GameObjectMapping {
    // Required methods
    fn get_err(&self, key: &str) -> Result<&SaveFileValue, KeyError>;
    fn get_string(&self, key: &str) -> Result<Rc<str>, SaveObjectError>;
    fn get_object(&self, key: &str) -> Result<&SaveFileObject, SaveObjectError>;
    fn get_integer(&self, key: &str) -> Result<i64, SaveObjectError>;
    fn get_real(&self, key: &str) -> Result<f64, SaveObjectError>;
    fn get_game_id(&self, key: &str) -> Result<u32, SaveObjectError>;
    fn get_date(&self, key: &str) -> Result<Date, SaveObjectError>;
}

Required Methods§

Source

fn get_err(&self, key: &str) -> Result<&SaveFileValue, KeyError>

Get the value of a key, or return an error if the key is missing. Essentially a different flavor of HashMap::get. The error is lazily initialized, so performance if the key is present is not affected.

Source

fn get_string(&self, key: &str) -> Result<Rc<str>, SaveObjectError>

Get the value of a key as a string.

Source

fn get_object(&self, key: &str) -> Result<&SaveFileObject, SaveObjectError>

Get the value of a key as an object.

Source

fn get_integer(&self, key: &str) -> Result<i64, SaveObjectError>

Get the value of a key as an integer.

Source

fn get_real(&self, key: &str) -> Result<f64, SaveObjectError>

Get the value of a key as a real number.

Source

fn get_game_id(&self, key: &str) -> Result<u32, SaveObjectError>

Get the value of a key as a GameId.

Source

fn get_date(&self, key: &str) -> Result<Date, SaveObjectError>

Get the value of a key as a date.

Implementations on Foreign Types§

Source§

impl GameObjectMapping for HashMap<String, SaveFileValue>

Implementors§