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§
Structs§
- Database
- System parameter for immutable access to a table of type
E. - Database
Mut - 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§
- AppTables
Ext - 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
Tablecan be stored in resource tables.