96 lines
2.9 KiB
Rust
96 lines
2.9 KiB
Rust
// 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::hand_type::Hand;
|
|
use super::tile_type::Tile;
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
|
|
/// Table handle for the table `hand`.
|
|
///
|
|
/// Obtain a handle from the [`HandTableAccess::hand`] method on [`super::RemoteTables`],
|
|
/// like `ctx.db.hand()`.
|
|
///
|
|
/// Users are encouraged not to explicitly reference this type,
|
|
/// but to directly chain method calls,
|
|
/// like `ctx.db.hand().on_insert(...)`.
|
|
pub struct HandTableHandle<'ctx> {
|
|
imp: __sdk::TableHandle<Hand>,
|
|
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the table `hand`.
|
|
///
|
|
/// Implemented for [`super::RemoteTables`].
|
|
pub trait HandTableAccess {
|
|
#[allow(non_snake_case)]
|
|
/// Obtain a [`HandTableHandle`], which mediates access to the table `hand`.
|
|
fn hand(&self) -> HandTableHandle<'_>;
|
|
}
|
|
|
|
impl HandTableAccess for super::RemoteTables {
|
|
fn hand(&self) -> HandTableHandle<'_> {
|
|
HandTableHandle {
|
|
imp: self.imp.get_table::<Hand>("hand"),
|
|
ctx: std::marker::PhantomData,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct HandInsertCallbackId(__sdk::CallbackId);
|
|
pub struct HandDeleteCallbackId(__sdk::CallbackId);
|
|
|
|
impl<'ctx> __sdk::Table for HandTableHandle<'ctx> {
|
|
type Row = Hand;
|
|
type EventContext = super::EventContext;
|
|
|
|
fn count(&self) -> u64 {
|
|
self.imp.count()
|
|
}
|
|
fn iter(&self) -> impl Iterator<Item = Hand> + '_ {
|
|
self.imp.iter()
|
|
}
|
|
|
|
type InsertCallbackId = HandInsertCallbackId;
|
|
|
|
fn on_insert(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> HandInsertCallbackId {
|
|
HandInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_insert(&self, callback: HandInsertCallbackId) {
|
|
self.imp.remove_on_insert(callback.0)
|
|
}
|
|
|
|
type DeleteCallbackId = HandDeleteCallbackId;
|
|
|
|
fn on_delete(
|
|
&self,
|
|
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
) -> HandDeleteCallbackId {
|
|
HandDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
}
|
|
|
|
fn remove_on_delete(&self, callback: HandDeleteCallbackId) {
|
|
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::<Hand>("hand");
|
|
}
|
|
|
|
#[doc(hidden)]
|
|
pub(super) fn parse_table_update(
|
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
|
) -> __sdk::Result<__sdk::TableUpdate<Hand>> {
|
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
|
__sdk::InternalError::failed_parse("TableUpdate<Hand>", "TableUpdate")
|
|
.with_cause(e)
|
|
.into()
|
|
})
|
|
}
|