This commit is contained in:
Tao Tien 2026-02-22 00:39:51 -08:00
parent d7b4221727
commit 2d3993452b
33 changed files with 920 additions and 143 deletions

View file

@ -0,0 +1,113 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::db_tile_type::DbTile;
use super::player_hand_type::PlayerHand;
use super::turn_state_type::TurnState;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `view_hand`.
///
/// Obtain a handle from the [`ViewHandTableAccess::view_hand`] method on [`super::RemoteTables`],
/// like `ctx.db.view_hand()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.view_hand().on_insert(...)`.
pub struct ViewHandTableHandle<'ctx> {
imp: __sdk::TableHandle<PlayerHand>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `view_hand`.
///
/// Implemented for [`super::RemoteTables`].
pub trait ViewHandTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`ViewHandTableHandle`], which mediates access to the table `view_hand`.
fn view_hand(&self) -> ViewHandTableHandle<'_>;
}
impl ViewHandTableAccess for super::RemoteTables {
fn view_hand(&self) -> ViewHandTableHandle<'_> {
ViewHandTableHandle {
imp: self.imp.get_table::<PlayerHand>("view_hand"),
ctx: std::marker::PhantomData,
}
}
}
pub struct ViewHandInsertCallbackId(__sdk::CallbackId);
pub struct ViewHandDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for ViewHandTableHandle<'ctx> {
type Row = PlayerHand;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = PlayerHand> + '_ {
self.imp.iter()
}
type InsertCallbackId = ViewHandInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ViewHandInsertCallbackId {
ViewHandInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: ViewHandInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = ViewHandDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ViewHandDeleteCallbackId {
ViewHandDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: ViewHandDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<PlayerHand>("view_hand");
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
) -> __sdk::Result<__sdk::TableUpdate<PlayerHand>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<PlayerHand>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `PlayerHand`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait view_handQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `PlayerHand`.
fn view_hand(&self) -> __sdk::__query_builder::Table<PlayerHand>;
}
impl view_handQueryTableAccess for __sdk::QueryTableAccessor {
fn view_hand(&self) -> __sdk::__query_builder::Table<PlayerHand> {
__sdk::__query_builder::Table::new("view_hand")
}
}