Skip to main content

Crate suon_database

Crate suon_database 

Source
Expand description

Lightweight database-table resources for Bevy apps.

This crate wraps typed resources in a small table abstraction so systems can read and mutate game data through focused SystemParam types instead of reaching for raw resources directly.

§Examples

use bevy::prelude::*;
use suon_database::{AppTablesExt, Database, DatabaseMut, Table};

#[derive(Default)]
struct HealthTable {
    hp: u32,
}

impl Table for HealthTable {}

let mut app = App::new();
app.init_database_table::<HealthTable>();

app.add_systems(Update, |mut table: DatabaseMut<HealthTable>| {
    table.hp = 42;
});
app.add_systems(PostUpdate, |table: Database<HealthTable>| {
    assert_eq!(table.hp, 42);
});

app.update();

Modules§

prelude

Structs§

Database
System parameter for immutable access to a table of type E.
DatabaseMut
System parameter for mutable access to a table of type E.
Tables
Resource that holds a specific table of type T. Provides shared access to the table.

Traits§

AppTablesExt
Extension trait providing convenience methods for managing database tables within Bevy’s App.
Table
Trait that marks a structure as a database table. Types implementing Table can be stored in resource tables.