Skip to main content

SaveKey

Trait SaveKey 

Source
pub trait SaveKey: Saves {
    type Value: SaveValue;

    // Required method
    fn fallback(&self) -> Self::Value;
}
Expand description

One thing a game keeps between runs, named by a vocabulary of its own.

Required if you want save and saved to take a key: they read and keep its Value and nothing else. Every key of a vocabulary keeps the same kind of value; keys of another kind need a vocabulary of their own.

Required Associated Types§

Source

type Value: SaveValue

The value this key keeps, of the four a store takes.

Required Methods§

Source

fn fallback(&self) -> Self::Value

Value this key reads as before any run has saved it. Saving this value again leaves the key at the same fallback.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§