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