pub struct SaveHeader {
pub magic: [u8; 4],
pub version: u32,
pub game_version: String,
pub timestamp: u64,
pub player_name: String,
pub play_time_seconds: f64,
pub metadata: HashMap<String, String>,
}Expand description
Metadata stored at the top of a save file.
The header is always present and can be read without loading the full snapshot, which is useful for displaying slot previews in a save/load menu.
Fields§
§magic: [u8; 4]Magic bytes — always SAVE_MAGIC.
version: u32Format version (not the game version).
game_version: StringHuman-readable game version string, e.g. "1.2.3".
timestamp: u64Unix timestamp (seconds) when this save was written.
player_name: StringPlayer name at save time.
play_time_seconds: f64Cumulative play time in seconds.
metadata: HashMap<String, String>Arbitrary key-value metadata (level name, difficulty, etc.).
Implementations§
Source§impl SaveHeader
impl SaveHeader
pub fn new() -> Self
pub fn with_player(self, name: impl Into<String>) -> Self
pub fn with_play_time(self, secs: f64) -> Self
pub fn with_game_version(self, ver: impl Into<String>) -> Self
pub fn set_meta(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn get_meta(&self, key: &str) -> Option<&str>
Trait Implementations§
Source§impl Clone for SaveHeader
impl Clone for SaveHeader
Source§fn clone(&self) -> SaveHeader
fn clone(&self) -> SaveHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SaveHeader
impl Debug for SaveHeader
Auto Trait Implementations§
impl Freeze for SaveHeader
impl RefUnwindSafe for SaveHeader
impl Send for SaveHeader
impl Sync for SaveHeader
impl Unpin for SaveHeader
impl UnsafeUnpin for SaveHeader
impl UnwindSafe for SaveHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more