Skip to content

Commit 7d75e9f

Browse files
authored
Table accessor + capabilities trait (#85)
1 parent fa2fbcf commit 7d75e9f

13 files changed

Lines changed: 238 additions & 268 deletions

File tree

Cargo.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_stdb"
3-
version = "0.12.2"
3+
version = "0.13.0"
44
edition = "2024"
55
rust-version = "1.95.0"
66
description = "A Bevy-native integration for SpacetimeDB with table messages, subscriptions, and reconnect support."
@@ -24,7 +24,7 @@ bevy_app = "0.19"
2424
bevy_ecs = "0.19"
2525
bevy_tasks = "0.19"
2626
bevy_time = "0.19"
27-
spacetimedb-sdk = "2"
27+
spacetimedb-sdk = "2.7"
2828
crossbeam-channel = "0.5"
2929

3030
[features]

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ A [Bevy](https://bevy.org/) integration for [SpacetimeDB](https://spacetimedb.co
3030
```rust
3131
use bevy::prelude::*;
3232
use bevy_stdb::prelude::*;
33-
use crate::module_bindings::{DbConnection, PlayerInfo, RemoteModule};
33+
use crate::module_bindings::{DbConnection, PlayerInfo, PlayerInfoTableAccessor, RemoteModule};
3434

3535
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
3636
pub enum MySubKey {
@@ -48,7 +48,7 @@ fn main() {
4848
StdbPlugin::<DbConnection, RemoteModule>::default()
4949
.with_database_name("my_module")
5050
.with_uri("http://localhost:3000")
51-
.add_table::<PlayerInfo>(|reg, db| reg.bind(db.player_info()))
51+
.add_table::<PlayerInfoTableAccessor>()
5252
.with_subscriptions::<MySubKey>()
5353
.with_reconnect(StdbReconnectOptions::default())
5454
.with_background_driver(DbConnection::run_threaded),
@@ -171,7 +171,7 @@ fn main() {
171171

172172
Use the `StdbPlugin` builder methods to register table bindings during app setup.
173173

174-
Each method eagerly registers the internal Bevy message channels for the row type you specify and stores a deferred binding callback that runs whenever a connection becomes active.
174+
Each method eagerly registers the internal Bevy message channels for the row type and stores a deferred binding that runs whenever a connection becomes active.
175175

176176
| Method | Use when |
177177
|---|---|
@@ -181,10 +181,10 @@ Each method eagerly registers the internal Bevy message channels for the row typ
181181
| `add_view` | Server-computed virtual table — exposes insert and delete message readers |
182182

183183
```rust
184-
.add_table::<PlayerInfo>(|reg, db| reg.bind(db.player_info()))
185-
.add_table_without_pk::<WorldClock>(|reg, db| reg.bind(db.world_clock()))
186-
.add_event_table::<DamageEvent>(|reg, db| reg.bind(db.damage_events()))
187-
.add_view::<NearbyMonster>(|reg, db| reg.bind(db.nearby_monsters()))
184+
.add_table::<PlayerInfoTableAccessor>()
185+
.add_table_without_pk::<WorldClockTableAccessor>()
186+
.add_event_table::<DamageEventsTableAccessor>()
187+
.add_view::<NearbyMonstersTableAccessor>()
188188
```
189189

190190
## Reading table events

examples/simple/Cargo.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)