embedded-savegame

Crates.ioembedded-savegame
lib.rsembedded-savegame
version0.3.0
created_at2025-12-18 16:37:49.961576+00
updated_at2026-01-13 17:13:47.145959+00
descriptionSavegame library for embedded with power-fail safety and wear leveling
homepage
repositoryhttps://github.com/kpcyrd/embedded-savegame
max_upload_size
id1992805
size63,103
(kpcyrd)

documentation

README

embedded-savegame

Crates.io Documentation

A no_std savegame library for embedded systems with power-fail safety and wear leveling.

⚠️ Work in progress: The on-disk format may still change with no migration path between versions.

Supported Flash Hardware

  • AT24Cxx EEPROM (via eeprom24x feature)
  • W25Q NOR flash (via w25q feature)
  • Custom hardware (implement the Flash trait)

Quick Start

Add to your Cargo.toml:

[dependencies]
embedded-savegame = "0.2"

# Enable support for your flash hardware:
# embedded-savegame = { version = "0.2", features = ["eeprom24x"] }
# embedded-savegame = { version = "0.2", features = ["w25q"] }

Usage Example

use embedded_savegame::storage::{Storage, Slot};

// Configure storage: 64-byte slots, 8 total slots
const SLOT_SIZE: usize = 64;
const SLOT_COUNT: usize = 8;

// Create storage manager with your flash device
let mut storage = Storage::<_, SLOT_SIZE, SLOT_COUNT>::new(flash_device);

// Scan for existing savegame
if let Ok(Some(slot)) = storage.scan() {
    let mut buf = [0u8; 256];
    if let Ok(Some(data)) = storage.read(slot.idx, &mut buf) {
        // Process loaded savegame
        process_game_state(data);
    }
}

// Write a new savegame
let mut game_data = serialize_game_state();
storage.append(&mut game_data)?;

License

MIT OR Apache-2.0

Commit count: 37

cargo fmt