2026-02-06 23:51:08 -08:00
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094).
#![ allow(unused, clippy::all) ]
2026-02-20 15:36:04 -08:00
use spacetimedb_sdk ::__codegen ::{
self as __sdk ,
__lib ,
__sats ,
__ws ,
} ;
2026-02-06 23:51:08 -08:00
2026-02-08 00:10:10 -08:00
pub mod bot_type ;
2026-02-12 17:06:28 -08:00
pub mod db_tile_type ;
pub mod db_wall_type ;
2026-02-07 17:46:03 -08:00
pub mod dragon_type ;
2026-02-08 18:15:09 -08:00
pub mod game_state_type ;
2026-02-20 15:36:04 -08:00
pub mod game_timer_type ;
2026-02-07 22:45:43 -08:00
pub mod lobby_type ;
2026-02-07 17:46:03 -08:00
pub mod player_type ;
2026-02-20 15:36:04 -08:00
pub mod player_clock_type ;
pub mod player_hand_type ;
pub mod player_or_bot_type ;
2026-02-07 17:46:03 -08:00
pub mod rank_type ;
pub mod suit_type ;
pub mod tile_type ;
2026-02-10 01:40:13 -08:00
pub mod turn_state_type ;
2026-02-07 17:46:03 -08:00
pub mod wind_type ;
2026-02-20 15:36:04 -08:00
pub mod add_bot_reducer ;
pub mod advance_game_reducer ;
pub mod clear_all_reducer ;
pub mod connect_reducer ;
pub mod discard_tile_reducer ;
pub mod disconnect_reducer ;
pub mod join_or_create_lobby_reducer ;
pub mod set_ready_reducer ;
pub mod bot_table ;
pub mod game_timer_table ;
pub mod lobby_table ;
pub mod logged_out_player_table ;
pub mod player_table ;
pub mod player_clock_table ;
pub mod player_hand_table ;
pub mod tile_table ;
pub mod wall_table ;
2026-02-07 17:46:03 -08:00
2026-02-08 00:10:10 -08:00
pub use bot_type ::Bot ;
2026-02-12 17:06:28 -08:00
pub use db_tile_type ::DbTile ;
pub use db_wall_type ::DbWall ;
2026-02-07 17:46:03 -08:00
pub use dragon_type ::Dragon ;
2026-02-08 18:15:09 -08:00
pub use game_state_type ::GameState ;
2026-02-20 15:36:04 -08:00
pub use game_timer_type ::GameTimer ;
2026-02-07 22:45:43 -08:00
pub use lobby_type ::Lobby ;
2026-02-07 17:46:03 -08:00
pub use player_type ::Player ;
2026-02-20 15:36:04 -08:00
pub use player_clock_type ::PlayerClock ;
pub use player_hand_type ::PlayerHand ;
pub use player_or_bot_type ::PlayerOrBot ;
2026-02-07 17:46:03 -08:00
pub use rank_type ::Rank ;
pub use suit_type ::Suit ;
pub use tile_type ::Tile ;
2026-02-10 01:40:13 -08:00
pub use turn_state_type ::TurnState ;
2026-02-07 17:46:03 -08:00
pub use wind_type ::Wind ;
2026-02-20 15:36:04 -08:00
pub use bot_table ::* ;
pub use game_timer_table ::* ;
pub use lobby_table ::* ;
pub use logged_out_player_table ::* ;
pub use player_table ::* ;
pub use player_clock_table ::* ;
pub use player_hand_table ::* ;
pub use tile_table ::* ;
pub use wall_table ::* ;
pub use add_bot_reducer ::{ add_bot , set_flags_for_add_bot , AddBotCallbackId } ;
pub use advance_game_reducer ::{ advance_game , set_flags_for_advance_game , AdvanceGameCallbackId } ;
pub use clear_all_reducer ::{ clear_all , set_flags_for_clear_all , ClearAllCallbackId } ;
pub use connect_reducer ::{ connect , set_flags_for_connect , ConnectCallbackId } ;
pub use discard_tile_reducer ::{ discard_tile , set_flags_for_discard_tile , DiscardTileCallbackId } ;
pub use disconnect_reducer ::{ disconnect , set_flags_for_disconnect , DisconnectCallbackId } ;
pub use join_or_create_lobby_reducer ::{ join_or_create_lobby , set_flags_for_join_or_create_lobby , JoinOrCreateLobbyCallbackId } ;
pub use set_ready_reducer ::{ set_ready , set_flags_for_set_ready , SetReadyCallbackId } ;
2026-02-06 23:51:08 -08:00
#[ derive(Clone, PartialEq, Debug) ]
/// One of the reducers defined by this module.
///
/// Contained within a [`__sdk::ReducerEvent`] in [`EventContext`]s for reducer events
/// to indicate which reducer caused the event.
pub enum Reducer {
2026-02-20 15:36:04 -08:00
AddBot {
lobby_id : u32 ,
} ,
AdvanceGame {
game_timer : GameTimer ,
} ,
ClearAll ,
Connect ,
DiscardTile {
tile_id : u32 ,
} ,
Disconnect ,
JoinOrCreateLobby {
lobby_id : u32 ,
} ,
SetReady {
ready : bool ,
} ,
2026-02-06 23:51:08 -08:00
}
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
impl __sdk ::InModule for Reducer {
type Module = RemoteModule ;
}
impl __sdk ::Reducer for Reducer {
fn reducer_name ( & self ) -> & 'static str {
match self {
2026-02-20 15:36:04 -08:00
Reducer ::AddBot { .. } = > " add_bot " ,
Reducer ::AdvanceGame { .. } = > " advance_game " ,
2026-02-15 07:09:19 -08:00
Reducer ::ClearAll = > " clear_all " ,
2026-02-20 15:36:04 -08:00
Reducer ::Connect = > " connect " ,
2026-02-13 07:49:09 -08:00
Reducer ::DiscardTile { .. } = > " discard_tile " ,
2026-02-20 15:36:04 -08:00
Reducer ::Disconnect = > " disconnect " ,
2026-02-07 22:45:43 -08:00
Reducer ::JoinOrCreateLobby { .. } = > " join_or_create_lobby " ,
2026-02-10 19:38:41 -08:00
Reducer ::SetReady { .. } = > " set_ready " ,
2026-02-06 23:51:08 -08:00
_ = > unreachable! ( ) ,
2026-02-20 15:36:04 -08:00
}
}
2026-02-06 23:51:08 -08:00
}
impl TryFrom < __ws ::ReducerCallInfo < __ws ::BsatnFormat > > for Reducer {
2026-02-20 15:36:04 -08:00
type Error = __sdk ::Error ;
fn try_from ( value : __ws ::ReducerCallInfo < __ws ::BsatnFormat > ) -> __sdk ::Result < Self > {
2026-02-06 23:51:08 -08:00
match & value . reducer_name [ .. ] {
2026-02-20 15:36:04 -08:00
" add_bot " = > Ok ( __sdk ::parse_reducer_args ::< add_bot_reducer ::AddBotArgs > ( " add_bot " , & value . args ) ? . into ( ) ) ,
" advance_game " = > Ok ( __sdk ::parse_reducer_args ::< advance_game_reducer ::AdvanceGameArgs > ( " advance_game " , & value . args ) ? . into ( ) ) ,
" clear_all " = > Ok ( __sdk ::parse_reducer_args ::< clear_all_reducer ::ClearAllArgs > ( " clear_all " , & value . args ) ? . into ( ) ) ,
" connect " = > Ok ( __sdk ::parse_reducer_args ::< connect_reducer ::ConnectArgs > ( " connect " , & value . args ) ? . into ( ) ) ,
" discard_tile " = > Ok ( __sdk ::parse_reducer_args ::< discard_tile_reducer ::DiscardTileArgs > ( " discard_tile " , & value . args ) ? . into ( ) ) ,
" disconnect " = > Ok ( __sdk ::parse_reducer_args ::< disconnect_reducer ::DisconnectArgs > ( " disconnect " , & value . args ) ? . into ( ) ) ,
" join_or_create_lobby " = > Ok ( __sdk ::parse_reducer_args ::< join_or_create_lobby_reducer ::JoinOrCreateLobbyArgs > ( " join_or_create_lobby " , & value . args ) ? . into ( ) ) ,
" set_ready " = > Ok ( __sdk ::parse_reducer_args ::< set_ready_reducer ::SetReadyArgs > ( " set_ready " , & value . args ) ? . into ( ) ) ,
unknown = > Err ( __sdk ::InternalError ::unknown_name ( " reducer " , unknown , " ReducerCallInfo " ) . into ( ) ) ,
}
}
2026-02-06 23:51:08 -08:00
}
#[ derive(Default) ]
#[ allow(non_snake_case) ]
#[ doc(hidden) ]
pub struct DbUpdate {
2026-02-20 15:36:04 -08:00
bot : __sdk ::TableUpdate < Bot > ,
game_timer : __sdk ::TableUpdate < GameTimer > ,
2026-02-07 22:45:43 -08:00
lobby : __sdk ::TableUpdate < Lobby > ,
2026-02-20 15:36:04 -08:00
logged_out_player : __sdk ::TableUpdate < Player > ,
2026-02-07 17:46:03 -08:00
player : __sdk ::TableUpdate < Player > ,
2026-02-20 15:36:04 -08:00
player_clock : __sdk ::TableUpdate < PlayerClock > ,
player_hand : __sdk ::TableUpdate < PlayerHand > ,
2026-02-12 17:06:28 -08:00
tile : __sdk ::TableUpdate < DbTile > ,
wall : __sdk ::TableUpdate < DbWall > ,
2026-02-06 23:51:08 -08:00
}
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
impl TryFrom < __ws ::DatabaseUpdate < __ws ::BsatnFormat > > for DbUpdate {
type Error = __sdk ::Error ;
fn try_from ( raw : __ws ::DatabaseUpdate < __ws ::BsatnFormat > ) -> Result < Self , Self ::Error > {
let mut db_update = DbUpdate ::default ( ) ;
for table_update in raw . tables {
match & table_update . table_name [ .. ] {
2026-02-20 15:36:04 -08:00
" bot " = > db_update . bot . append ( bot_table ::parse_table_update ( table_update ) ? ) ,
" game_timer " = > db_update . game_timer . append ( game_timer_table ::parse_table_update ( table_update ) ? ) ,
" lobby " = > db_update . lobby . append ( lobby_table ::parse_table_update ( table_update ) ? ) ,
" logged_out_player " = > db_update . logged_out_player . append ( logged_out_player_table ::parse_table_update ( table_update ) ? ) ,
" player " = > db_update . player . append ( player_table ::parse_table_update ( table_update ) ? ) ,
" player_clock " = > db_update . player_clock . append ( player_clock_table ::parse_table_update ( table_update ) ? ) ,
" player_hand " = > db_update . player_hand . append ( player_hand_table ::parse_table_update ( table_update ) ? ) ,
" tile " = > db_update . tile . append ( tile_table ::parse_table_update ( table_update ) ? ) ,
" wall " = > db_update . wall . append ( wall_table ::parse_table_update ( table_update ) ? ) ,
2026-02-06 23:51:08 -08:00
unknown = > {
return Err ( __sdk ::InternalError ::unknown_name (
" table " ,
unknown ,
" DatabaseUpdate " ,
2026-02-20 15:36:04 -08:00
) . into ( ) ) ;
2026-02-06 23:51:08 -08:00
}
}
}
Ok ( db_update )
}
}
impl __sdk ::InModule for DbUpdate {
type Module = RemoteModule ;
}
impl __sdk ::DbUpdate for DbUpdate {
2026-02-20 15:36:04 -08:00
fn apply_to_client_cache ( & self , cache : & mut __sdk ::ClientCache < RemoteModule > ) -> AppliedDiff < '_ > {
let mut diff = AppliedDiff ::default ( ) ;
diff . bot = cache . apply_diff_to_table ::< Bot > ( " bot " , & self . bot ) . with_updates_by_pk ( | row | & row . id ) ;
diff . game_timer = cache . apply_diff_to_table ::< GameTimer > ( " game_timer " , & self . game_timer ) . with_updates_by_pk ( | row | & row . id ) ;
diff . lobby = cache . apply_diff_to_table ::< Lobby > ( " lobby " , & self . lobby ) . with_updates_by_pk ( | row | & row . id ) ;
diff . logged_out_player = cache . apply_diff_to_table ::< Player > ( " logged_out_player " , & self . logged_out_player ) . with_updates_by_pk ( | row | & row . identity ) ;
diff . player = cache . apply_diff_to_table ::< Player > ( " player " , & self . player ) . with_updates_by_pk ( | row | & row . identity ) ;
diff . player_clock = cache . apply_diff_to_table ::< PlayerClock > ( " player_clock " , & self . player_clock ) . with_updates_by_pk ( | row | & row . id ) ;
diff . player_hand = cache . apply_diff_to_table ::< PlayerHand > ( " player_hand " , & self . player_hand ) . with_updates_by_pk ( | row | & row . id ) ;
diff . tile = cache . apply_diff_to_table ::< DbTile > ( " tile " , & self . tile ) . with_updates_by_pk ( | row | & row . id ) ;
diff . wall = cache . apply_diff_to_table ::< DbWall > ( " wall " , & self . wall ) . with_updates_by_pk ( | row | & row . lobby_id ) ;
diff
}
2026-02-06 23:51:08 -08:00
}
#[ derive(Default) ]
#[ allow(non_snake_case) ]
#[ doc(hidden) ]
pub struct AppliedDiff < ' r > {
2026-02-20 15:36:04 -08:00
bot : __sdk ::TableAppliedDiff < ' r , Bot > ,
game_timer : __sdk ::TableAppliedDiff < ' r , GameTimer > ,
2026-02-07 22:45:43 -08:00
lobby : __sdk ::TableAppliedDiff < ' r , Lobby > ,
2026-02-20 15:36:04 -08:00
logged_out_player : __sdk ::TableAppliedDiff < ' r , Player > ,
2026-02-07 17:46:03 -08:00
player : __sdk ::TableAppliedDiff < ' r , Player > ,
2026-02-20 15:36:04 -08:00
player_clock : __sdk ::TableAppliedDiff < ' r , PlayerClock > ,
player_hand : __sdk ::TableAppliedDiff < ' r , PlayerHand > ,
2026-02-12 17:06:28 -08:00
tile : __sdk ::TableAppliedDiff < ' r , DbTile > ,
wall : __sdk ::TableAppliedDiff < ' r , DbWall > ,
2026-02-06 23:51:08 -08:00
__unused : std ::marker ::PhantomData < & ' r ( ) > ,
}
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
impl __sdk ::InModule for AppliedDiff < '_ > {
type Module = RemoteModule ;
}
impl < ' r > __sdk ::AppliedDiff < ' r > for AppliedDiff < ' r > {
2026-02-20 15:36:04 -08:00
fn invoke_row_callbacks ( & self , event : & EventContext , callbacks : & mut __sdk ::DbCallbacks < RemoteModule > ) {
callbacks . invoke_table_row_callbacks ::< Bot > ( " bot " , & self . bot , event ) ;
callbacks . invoke_table_row_callbacks ::< GameTimer > ( " game_timer " , & self . game_timer , event ) ;
2026-02-07 22:45:43 -08:00
callbacks . invoke_table_row_callbacks ::< Lobby > ( " lobby " , & self . lobby , event ) ;
2026-02-20 15:36:04 -08:00
callbacks . invoke_table_row_callbacks ::< Player > ( " logged_out_player " , & self . logged_out_player , event ) ;
2026-02-07 17:46:03 -08:00
callbacks . invoke_table_row_callbacks ::< Player > ( " player " , & self . player , event ) ;
2026-02-20 15:36:04 -08:00
callbacks . invoke_table_row_callbacks ::< PlayerClock > ( " player_clock " , & self . player_clock , event ) ;
callbacks . invoke_table_row_callbacks ::< PlayerHand > ( " player_hand " , & self . player_hand , event ) ;
2026-02-12 17:06:28 -08:00
callbacks . invoke_table_row_callbacks ::< DbTile > ( " tile " , & self . tile , event ) ;
callbacks . invoke_table_row_callbacks ::< DbWall > ( " wall " , & self . wall , event ) ;
2026-02-20 15:36:04 -08:00
}
2026-02-06 23:51:08 -08:00
}
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
#[ doc(hidden) ]
pub struct RemoteModule ;
impl __sdk ::InModule for RemoteModule {
type Module = Self ;
}
/// The `reducers` field of [`EventContext`] and [`DbConnection`],
/// with methods provided by extension traits for each reducer defined by the module.
pub struct RemoteReducers {
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::InModule for RemoteReducers {
type Module = RemoteModule ;
}
/// The `procedures` field of [`DbConnection`] and other [`DbContext`] types,
/// with methods provided by extension traits for each procedure defined by the module.
pub struct RemoteProcedures {
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::InModule for RemoteProcedures {
type Module = RemoteModule ;
}
#[ doc(hidden) ]
/// The `set_reducer_flags` field of [`DbConnection`],
/// with methods provided by extension traits for each reducer defined by the module.
/// Each method sets the flags for the reducer with the same name.
///
/// This type is currently unstable and may be removed without a major version bump.
pub struct SetReducerFlags {
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::InModule for SetReducerFlags {
type Module = RemoteModule ;
}
/// The `db` field of [`EventContext`] and [`DbConnection`],
/// with methods provided by extension traits for each table defined by the module.
pub struct RemoteTables {
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::InModule for RemoteTables {
type Module = RemoteModule ;
}
/// A connection to a remote module, including a materialized view of a subset of the database.
///
/// Connect to a remote module by calling [`DbConnection::builder`]
/// and using the [`__sdk::DbConnectionBuilder`] builder-pattern constructor.
///
/// You must explicitly advance the connection by calling any one of:
///
/// - [`DbConnection::frame_tick`].
/// - [`DbConnection::run_threaded`].
/// - [`DbConnection::run_async`].
/// - [`DbConnection::advance_one_message`].
/// - [`DbConnection::advance_one_message_blocking`].
/// - [`DbConnection::advance_one_message_async`].
///
/// Which of these methods you should call depends on the specific needs of your application,
/// but you must call one of them, or else the connection will never progress.
pub struct DbConnection {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
#[ doc(hidden) ]
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::InModule for DbConnection {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for DbConnection {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl DbConnection {
/// Builder-pattern constructor for a connection to a remote module.
///
/// See [`__sdk::DbConnectionBuilder`] for required and optional configuration for the new connection.
pub fn builder ( ) -> __sdk ::DbConnectionBuilder < RemoteModule > {
__sdk ::DbConnectionBuilder ::new ( )
}
/// If any WebSocket messages are waiting, process one of them.
///
/// Returns `true` if a message was processed, or `false` if the queue is empty.
/// Callers should invoke this message in a loop until it returns `false`
/// or for as much time is available to process messages.
///
/// Returns an error if the connection is disconnected.
/// If the disconnection in question was normal,
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
///
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
/// Most applications should call [`Self::frame_tick`] each frame
/// to fully exhaust the queue whenever time is available.
pub fn advance_one_message ( & self ) -> __sdk ::Result < bool > {
self . imp . advance_one_message ( )
}
/// Process one WebSocket message, potentially blocking the current thread until one is received.
///
/// Returns an error if the connection is disconnected.
/// If the disconnection in question was normal,
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
///
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
/// Most applications should call [`Self::run_threaded`] to spawn a thread
/// which advances the connection automatically.
pub fn advance_one_message_blocking ( & self ) -> __sdk ::Result < ( ) > {
self . imp . advance_one_message_blocking ( )
}
/// Process one WebSocket message, `await`ing until one is received.
///
/// Returns an error if the connection is disconnected.
/// If the disconnection in question was normal,
/// i.e. the result of a call to [`__sdk::DbContext::disconnect`],
/// the returned error will be downcastable to [`__sdk::DisconnectedError`].
///
/// This is a low-level primitive exposed for power users who need significant control over scheduling.
/// Most applications should call [`Self::run_async`] to run an `async` loop
/// which advances the connection when polled.
pub async fn advance_one_message_async ( & self ) -> __sdk ::Result < ( ) > {
self . imp . advance_one_message_async ( ) . await
}
/// Process all WebSocket messages waiting in the queue,
/// then return without `await`ing or blocking the current thread.
pub fn frame_tick ( & self ) -> __sdk ::Result < ( ) > {
self . imp . frame_tick ( )
}
/// Spawn a thread which processes WebSocket messages as they are received.
pub fn run_threaded ( & self ) -> std ::thread ::JoinHandle < ( ) > {
self . imp . run_threaded ( )
}
/// Run an `async` loop which processes WebSocket messages when polled.
pub async fn run_async ( & self ) -> __sdk ::Result < ( ) > {
self . imp . run_async ( ) . await
}
}
impl __sdk ::DbConnection for DbConnection {
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
imp ,
}
}
}
/// A handle on a subscribed query.
// TODO: Document this better after implementing the new subscription API.
#[ derive(Clone) ]
pub struct SubscriptionHandle {
imp : __sdk ::SubscriptionHandleImpl < RemoteModule > ,
}
impl __sdk ::InModule for SubscriptionHandle {
type Module = RemoteModule ;
}
impl __sdk ::SubscriptionHandle for SubscriptionHandle {
fn new ( imp : __sdk ::SubscriptionHandleImpl < RemoteModule > ) -> Self {
Self { imp }
}
/// Returns true if this subscription has been terminated due to an unsubscribe call or an error.
fn is_ended ( & self ) -> bool {
self . imp . is_ended ( )
}
/// Returns true if this subscription has been applied and has not yet been unsubscribed.
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
/// Unsubscribe from the query controlled by this `SubscriptionHandle`,
/// then run `on_end` when its rows are removed from the client cache.
fn unsubscribe_then ( self , on_end : __sdk ::OnEndedCallback < RemoteModule > ) -> __sdk ::Result < ( ) > {
self . imp . unsubscribe_then ( Some ( on_end ) )
}
fn unsubscribe ( self ) -> __sdk ::Result < ( ) > {
self . imp . unsubscribe_then ( None )
}
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
}
/// Alias trait for a [`__sdk::DbContext`] connected to this module,
/// with that trait's associated types bounded to this module's concrete types.
///
/// Users can use this trait as a boundary on definitions which should accept
/// either a [`DbConnection`] or an [`EventContext`] and operate on either.
2026-02-20 15:36:04 -08:00
pub trait RemoteDbContext : __sdk ::DbContext <
2026-02-06 23:51:08 -08:00
DbView = RemoteTables ,
Reducers = RemoteReducers ,
SetReducerFlags = SetReducerFlags ,
SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ,
2026-02-20 15:36:04 -08:00
> { }
impl < Ctx : __sdk ::DbContext <
DbView = RemoteTables ,
Reducers = RemoteReducers ,
SetReducerFlags = SetReducerFlags ,
SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ,
> > RemoteDbContext for Ctx { }
2026-02-06 23:51:08 -08:00
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`],
/// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks.
pub struct EventContext {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
/// The event which caused these callbacks to run.
pub event : __sdk ::Event < Reducer > ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::AbstractEventContext for EventContext {
type Event = __sdk ::Event < Reducer > ;
fn event ( & self ) -> & Self ::Event {
& self . event
}
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > , event : Self ::Event ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
event ,
imp ,
}
}
}
impl __sdk ::InModule for EventContext {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for EventContext {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl __sdk ::EventContext for EventContext { }
/// An [`__sdk::DbContext`] augmented with a [`__sdk::ReducerEvent`],
/// passed to on-reducer callbacks.
pub struct ReducerEventContext {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
/// The event which caused these callbacks to run.
pub event : __sdk ::ReducerEvent < Reducer > ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::AbstractEventContext for ReducerEventContext {
type Event = __sdk ::ReducerEvent < Reducer > ;
fn event ( & self ) -> & Self ::Event {
& self . event
}
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > , event : Self ::Event ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
event ,
imp ,
}
}
}
impl __sdk ::InModule for ReducerEventContext {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for ReducerEventContext {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl __sdk ::ReducerEventContext for ReducerEventContext { }
/// An [`__sdk::DbContext`] passed to procedure callbacks.
pub struct ProcedureEventContext {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::AbstractEventContext for ProcedureEventContext {
type Event = ( ) ;
fn event ( & self ) -> & Self ::Event {
& ( )
}
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > , _event : Self ::Event ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
imp ,
}
}
}
impl __sdk ::InModule for ProcedureEventContext {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for ProcedureEventContext {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl __sdk ::ProcedureEventContext for ProcedureEventContext { }
/// An [`__sdk::DbContext`] passed to [`__sdk::SubscriptionBuilder::on_applied`] and [`SubscriptionHandle::unsubscribe_then`] callbacks.
pub struct SubscriptionEventContext {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::AbstractEventContext for SubscriptionEventContext {
type Event = ( ) ;
fn event ( & self ) -> & Self ::Event {
& ( )
}
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > , _event : Self ::Event ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
imp ,
}
}
}
impl __sdk ::InModule for SubscriptionEventContext {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for SubscriptionEventContext {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl __sdk ::SubscriptionEventContext for SubscriptionEventContext { }
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Error`],
/// passed to [`__sdk::DbConnectionBuilder::on_disconnect`], [`__sdk::DbConnectionBuilder::on_connect_error`] and [`__sdk::SubscriptionBuilder::on_error`] callbacks.
pub struct ErrorContext {
/// Access to tables defined by the module via extension traits implemented for [`RemoteTables`].
pub db : RemoteTables ,
/// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`].
pub reducers : RemoteReducers ,
/// Access to setting the call-flags of each reducer defined for each reducer defined by the module
/// via extension traits implemented for [`SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
pub set_reducer_flags : SetReducerFlags ,
/// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`].
pub procedures : RemoteProcedures ,
/// The event which caused these callbacks to run.
pub event : Option < __sdk ::Error > ,
imp : __sdk ::DbContextImpl < RemoteModule > ,
}
impl __sdk ::AbstractEventContext for ErrorContext {
type Event = Option < __sdk ::Error > ;
fn event ( & self ) -> & Self ::Event {
& self . event
}
fn new ( imp : __sdk ::DbContextImpl < RemoteModule > , event : Self ::Event ) -> Self {
Self {
db : RemoteTables { imp : imp . clone ( ) } ,
reducers : RemoteReducers { imp : imp . clone ( ) } ,
set_reducer_flags : SetReducerFlags { imp : imp . clone ( ) } ,
procedures : RemoteProcedures { imp : imp . clone ( ) } ,
event ,
imp ,
}
}
}
impl __sdk ::InModule for ErrorContext {
type Module = RemoteModule ;
}
impl __sdk ::DbContext for ErrorContext {
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type Procedures = RemoteProcedures ;
type SetReducerFlags = SetReducerFlags ;
fn db ( & self ) -> & Self ::DbView {
& self . db
}
fn reducers ( & self ) -> & Self ::Reducers {
& self . reducers
}
fn procedures ( & self ) -> & Self ::Procedures {
& self . procedures
}
fn set_reducer_flags ( & self ) -> & Self ::SetReducerFlags {
& self . set_reducer_flags
}
fn is_active ( & self ) -> bool {
self . imp . is_active ( )
}
fn disconnect ( & self ) -> __sdk ::Result < ( ) > {
self . imp . disconnect ( )
}
type SubscriptionBuilder = __sdk ::SubscriptionBuilder < RemoteModule > ;
fn subscription_builder ( & self ) -> Self ::SubscriptionBuilder {
__sdk ::SubscriptionBuilder ::new ( & self . imp )
}
fn try_identity ( & self ) -> Option < __sdk ::Identity > {
self . imp . try_identity ( )
}
fn connection_id ( & self ) -> __sdk ::ConnectionId {
self . imp . connection_id ( )
}
fn try_connection_id ( & self ) -> Option < __sdk ::ConnectionId > {
self . imp . try_connection_id ( )
}
}
impl __sdk ::ErrorContext for ErrorContext { }
impl __sdk ::SpacetimeModule for RemoteModule {
2026-02-20 15:36:04 -08:00
2026-02-06 23:51:08 -08:00
type DbConnection = DbConnection ;
type EventContext = EventContext ;
type ReducerEventContext = ReducerEventContext ;
type ProcedureEventContext = ProcedureEventContext ;
type SubscriptionEventContext = SubscriptionEventContext ;
type ErrorContext = ErrorContext ;
type Reducer = Reducer ;
type DbView = RemoteTables ;
type Reducers = RemoteReducers ;
type SetReducerFlags = SetReducerFlags ;
type DbUpdate = DbUpdate ;
type AppliedDiff < ' r > = AppliedDiff < ' r > ;
type SubscriptionHandle = SubscriptionHandle ;
2026-02-20 15:36:04 -08:00
fn register_tables ( client_cache : & mut __sdk ::ClientCache < Self > ) {
bot_table ::register_table ( client_cache ) ;
game_timer_table ::register_table ( client_cache ) ;
2026-02-07 22:45:43 -08:00
lobby_table ::register_table ( client_cache ) ;
2026-02-20 15:36:04 -08:00
logged_out_player_table ::register_table ( client_cache ) ;
2026-02-07 17:46:03 -08:00
player_table ::register_table ( client_cache ) ;
2026-02-20 15:36:04 -08:00
player_clock_table ::register_table ( client_cache ) ;
player_hand_table ::register_table ( client_cache ) ;
2026-02-12 17:06:28 -08:00
tile_table ::register_table ( client_cache ) ;
2026-02-07 17:46:03 -08:00
wall_table ::register_table ( client_cache ) ;
2026-02-20 15:36:04 -08:00
}
2026-02-06 23:51:08 -08:00
}