codegen
This commit is contained in:
parent
d1446309c4
commit
d7b4221727
41 changed files with 893 additions and 1673 deletions
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -20,8 +14,8 @@ impl From<AddBotArgs> for super::Reducer {
|
||||||
fn from(args: AddBotArgs) -> Self {
|
fn from(args: AddBotArgs) -> Self {
|
||||||
Self::AddBot {
|
Self::AddBot {
|
||||||
lobby_id: args.lobby_id,
|
lobby_id: args.lobby_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for AddBotArgs {
|
impl __sdk::InModule for AddBotArgs {
|
||||||
|
|
@ -40,8 +34,7 @@ pub trait add_bot {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_add_bot`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_add_bot`] callbacks.
|
||||||
fn add_bot(&self, lobby_id: u32,
|
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()>;
|
||||||
) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `add_bot`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `add_bot`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -49,35 +42,39 @@ pub trait add_bot {
|
||||||
///
|
///
|
||||||
/// The returned [`AddBotCallbackId`] can be passed to [`Self::remove_on_add_bot`]
|
/// The returned [`AddBotCallbackId`] can be passed to [`Self::remove_on_add_bot`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_add_bot(&self, callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static) -> AddBotCallbackId;
|
fn on_add_bot(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
|
) -> AddBotCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_add_bot`],
|
/// Cancel a callback previously registered by [`Self::on_add_bot`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_add_bot(&self, callback: AddBotCallbackId);
|
fn remove_on_add_bot(&self, callback: AddBotCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl add_bot for super::RemoteReducers {
|
impl add_bot for super::RemoteReducers {
|
||||||
fn add_bot(&self, lobby_id: u32,
|
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||||
) -> __sdk::Result<()> {
|
self.imp.call_reducer("add_bot", AddBotArgs { lobby_id })
|
||||||
self.imp.call_reducer("add_bot", AddBotArgs { lobby_id, })
|
|
||||||
}
|
}
|
||||||
fn on_add_bot(
|
fn on_add_bot(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
) -> AddBotCallbackId {
|
) -> AddBotCallbackId {
|
||||||
AddBotCallbackId(self.imp.on_reducer(
|
AddBotCallbackId(self.imp.on_reducer(
|
||||||
"add_bot",
|
"add_bot",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::AddBot {
|
__sdk::ReducerEvent {
|
||||||
lobby_id,
|
reducer: super::Reducer::AddBot { lobby_id },
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, lobby_id, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx, lobby_id)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -105,4 +102,3 @@ impl set_flags_for_add_bot for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("add_bot", flags);
|
self.imp.set_call_reducer_flags("add_bot", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::game_timer_type::GameTimer;
|
use super::game_timer_type::GameTimer;
|
||||||
|
|
||||||
|
|
@ -21,8 +16,8 @@ impl From<AdvanceGameArgs> for super::Reducer {
|
||||||
fn from(args: AdvanceGameArgs) -> Self {
|
fn from(args: AdvanceGameArgs) -> Self {
|
||||||
Self::AdvanceGame {
|
Self::AdvanceGame {
|
||||||
game_timer: args.game_timer,
|
game_timer: args.game_timer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for AdvanceGameArgs {
|
impl __sdk::InModule for AdvanceGameArgs {
|
||||||
|
|
@ -41,8 +36,7 @@ pub trait advance_game {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_advance_game`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_advance_game`] callbacks.
|
||||||
fn advance_game(&self, game_timer: GameTimer,
|
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()>;
|
||||||
) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `advance_game`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `advance_game`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -50,35 +44,40 @@ pub trait advance_game {
|
||||||
///
|
///
|
||||||
/// The returned [`AdvanceGameCallbackId`] can be passed to [`Self::remove_on_advance_game`]
|
/// The returned [`AdvanceGameCallbackId`] can be passed to [`Self::remove_on_advance_game`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_advance_game(&self, callback: impl FnMut(&super::ReducerEventContext, &GameTimer, ) + Send + 'static) -> AdvanceGameCallbackId;
|
fn on_advance_game(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
||||||
|
) -> AdvanceGameCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_advance_game`],
|
/// Cancel a callback previously registered by [`Self::on_advance_game`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId);
|
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl advance_game for super::RemoteReducers {
|
impl advance_game for super::RemoteReducers {
|
||||||
fn advance_game(&self, game_timer: GameTimer,
|
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()> {
|
||||||
) -> __sdk::Result<()> {
|
self.imp
|
||||||
self.imp.call_reducer("advance_game", AdvanceGameArgs { game_timer, })
|
.call_reducer("advance_game", AdvanceGameArgs { game_timer })
|
||||||
}
|
}
|
||||||
fn on_advance_game(
|
fn on_advance_game(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &GameTimer, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
||||||
) -> AdvanceGameCallbackId {
|
) -> AdvanceGameCallbackId {
|
||||||
AdvanceGameCallbackId(self.imp.on_reducer(
|
AdvanceGameCallbackId(self.imp.on_reducer(
|
||||||
"advance_game",
|
"advance_game",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::AdvanceGame {
|
__sdk::ReducerEvent {
|
||||||
game_timer,
|
reducer: super::Reducer::AdvanceGame { game_timer },
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, game_timer, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx, game_timer)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -106,4 +105,3 @@ impl set_flags_for_advance_game for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("advance_game", flags);
|
self.imp.set_call_reducer_flags("advance_game", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,144 +0,0 @@
|
||||||
// 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::advance_state_timer_type::AdvanceStateTimer;
|
|
||||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
/// Table handle for the table `advance_state_timer`.
|
|
||||||
///
|
|
||||||
/// Obtain a handle from the [`AdvanceStateTimerTableAccess::advance_state_timer`] method on [`super::RemoteTables`],
|
|
||||||
/// like `ctx.db.advance_state_timer()`.
|
|
||||||
///
|
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
|
||||||
/// but to directly chain method calls,
|
|
||||||
/// like `ctx.db.advance_state_timer().on_insert(...)`.
|
|
||||||
pub struct AdvanceStateTimerTableHandle<'ctx> {
|
|
||||||
imp: __sdk::TableHandle<AdvanceStateTimer>,
|
|
||||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the table `advance_state_timer`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteTables`].
|
|
||||||
pub trait AdvanceStateTimerTableAccess {
|
|
||||||
#[allow(non_snake_case)]
|
|
||||||
/// Obtain a [`AdvanceStateTimerTableHandle`], which mediates access to the table `advance_state_timer`.
|
|
||||||
fn advance_state_timer(&self) -> AdvanceStateTimerTableHandle<'_>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AdvanceStateTimerTableAccess for super::RemoteTables {
|
|
||||||
fn advance_state_timer(&self) -> AdvanceStateTimerTableHandle<'_> {
|
|
||||||
AdvanceStateTimerTableHandle {
|
|
||||||
imp: self
|
|
||||||
.imp
|
|
||||||
.get_table::<AdvanceStateTimer>("advance_state_timer"),
|
|
||||||
ctx: std::marker::PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct AdvanceStateTimerInsertCallbackId(__sdk::CallbackId);
|
|
||||||
pub struct AdvanceStateTimerDeleteCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
impl<'ctx> __sdk::Table for AdvanceStateTimerTableHandle<'ctx> {
|
|
||||||
type Row = AdvanceStateTimer;
|
|
||||||
type EventContext = super::EventContext;
|
|
||||||
|
|
||||||
fn count(&self) -> u64 {
|
|
||||||
self.imp.count()
|
|
||||||
}
|
|
||||||
fn iter(&self) -> impl Iterator<Item = AdvanceStateTimer> + '_ {
|
|
||||||
self.imp.iter()
|
|
||||||
}
|
|
||||||
|
|
||||||
type InsertCallbackId = AdvanceStateTimerInsertCallbackId;
|
|
||||||
|
|
||||||
fn on_insert(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
||||||
) -> AdvanceStateTimerInsertCallbackId {
|
|
||||||
AdvanceStateTimerInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn remove_on_insert(&self, callback: AdvanceStateTimerInsertCallbackId) {
|
|
||||||
self.imp.remove_on_insert(callback.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeleteCallbackId = AdvanceStateTimerDeleteCallbackId;
|
|
||||||
|
|
||||||
fn on_delete(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
|
||||||
) -> AdvanceStateTimerDeleteCallbackId {
|
|
||||||
AdvanceStateTimerDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn remove_on_delete(&self, callback: AdvanceStateTimerDeleteCallbackId) {
|
|
||||||
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::<AdvanceStateTimer>("advance_state_timer");
|
|
||||||
_table.add_unique_constraint::<u64>("scheduled_id", |row| &row.scheduled_id);
|
|
||||||
}
|
|
||||||
pub struct AdvanceStateTimerUpdateCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
impl<'ctx> __sdk::TableWithPrimaryKey for AdvanceStateTimerTableHandle<'ctx> {
|
|
||||||
type UpdateCallbackId = AdvanceStateTimerUpdateCallbackId;
|
|
||||||
|
|
||||||
fn on_update(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
|
||||||
) -> AdvanceStateTimerUpdateCallbackId {
|
|
||||||
AdvanceStateTimerUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn remove_on_update(&self, callback: AdvanceStateTimerUpdateCallbackId) {
|
|
||||||
self.imp.remove_on_update(callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub(super) fn parse_table_update(
|
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<AdvanceStateTimer>> {
|
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
|
||||||
__sdk::InternalError::failed_parse("TableUpdate<AdvanceStateTimer>", "TableUpdate")
|
|
||||||
.with_cause(e)
|
|
||||||
.into()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Access to the `scheduled_id` unique index on the table `advance_state_timer`,
|
|
||||||
/// which allows point queries on the field of the same name
|
|
||||||
/// via the [`AdvanceStateTimerScheduledIdUnique::find`] method.
|
|
||||||
///
|
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
|
||||||
/// but to directly chain method calls,
|
|
||||||
/// like `ctx.db.advance_state_timer().scheduled_id().find(...)`.
|
|
||||||
pub struct AdvanceStateTimerScheduledIdUnique<'ctx> {
|
|
||||||
imp: __sdk::UniqueConstraintHandle<AdvanceStateTimer, u64>,
|
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ctx> AdvanceStateTimerTableHandle<'ctx> {
|
|
||||||
/// Get a handle on the `scheduled_id` unique index on the table `advance_state_timer`.
|
|
||||||
pub fn scheduled_id(&self) -> AdvanceStateTimerScheduledIdUnique<'ctx> {
|
|
||||||
AdvanceStateTimerScheduledIdUnique {
|
|
||||||
imp: self.imp.get_unique_constraint::<u64>("scheduled_id"),
|
|
||||||
phantom: std::marker::PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ctx> AdvanceStateTimerScheduledIdUnique<'ctx> {
|
|
||||||
/// Find the subscribed row whose `scheduled_id` column value is equal to `col_val`,
|
|
||||||
/// if such a row is present in the client cache.
|
|
||||||
pub fn find(&self, col_val: &u64) -> Option<AdvanceStateTimer> {
|
|
||||||
self.imp.find(col_val)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub struct AdvanceStateTimer {
|
|
||||||
pub scheduled_id: u64,
|
|
||||||
pub scheduled_at: __sdk::ScheduleAt,
|
|
||||||
pub lobby_id: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for AdvanceStateTimer {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::bot_type::Bot;
|
use super::bot_type::Bot;
|
||||||
use super::turn_state_type::TurnState;
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
|
use super::turn_state_type::TurnState;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `bot`.
|
/// Table handle for the table `bot`.
|
||||||
///
|
///
|
||||||
|
|
@ -51,8 +46,12 @@ impl<'ctx> __sdk::Table for BotTableHandle<'ctx> {
|
||||||
type Row = Bot;
|
type Row = Bot;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = Bot> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = Bot> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = BotInsertCallbackId;
|
type InsertCallbackId = BotInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -83,7 +82,6 @@ impl<'ctx> __sdk::Table for BotTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<Bot>("bot");
|
let _table = client_cache.get_or_make_table::<Bot>("bot");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
}
|
}
|
||||||
|
|
@ -104,32 +102,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BotTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<Bot>> {
|
) -> __sdk::Result<__sdk::TableUpdate<Bot>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<Bot>", "TableUpdate")
|
||||||
"TableUpdate<Bot>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `bot`,
|
/// Access to the `id` unique index on the table `bot`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`BotIdUnique::find`] method.
|
/// via the [`BotIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.bot().id().find(...)`.
|
/// like `ctx.db.bot().id().find(...)`.
|
||||||
pub struct BotIdUnique<'ctx> {
|
pub struct BotIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Bot, u32>,
|
imp: __sdk::UniqueConstraintHandle<Bot, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> BotTableHandle<'ctx> {
|
impl<'ctx> BotTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `bot`.
|
/// Get a handle on the `id` unique index on the table `bot`.
|
||||||
pub fn id(&self) -> BotIdUnique<'ctx> {
|
pub fn id(&self) -> BotIdUnique<'ctx> {
|
||||||
BotIdUnique {
|
BotIdUnique {
|
||||||
|
|
@ -137,13 +133,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> BotIdUnique<'ctx> {
|
impl<'ctx> BotIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<Bot> {
|
pub fn find(&self, col_val: &u32) -> Option<Bot> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::turn_state_type::TurnState;
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
|
use super::turn_state_type::TurnState;
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -18,13 +13,11 @@ pub struct Bot {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
pub lobby_id: u32,
|
pub lobby_id: u32,
|
||||||
pub turn_state: TurnState,
|
pub turn_state: TurnState,
|
||||||
pub hand: Vec::<DbTile>,
|
pub hand: Vec<DbTile>,
|
||||||
pub pond: Vec::<DbTile>,
|
pub pond: Vec<DbTile>,
|
||||||
pub working_tile: Option::<DbTile>,
|
pub working_tile: Option<DbTile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Bot {
|
impl __sdk::InModule for Bot {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,16 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub(super) struct ClearAllArgs {
|
pub(super) struct ClearAllArgs {}
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ClearAllArgs> for super::Reducer {
|
impl From<ClearAllArgs> for super::Reducer {
|
||||||
fn from(args: ClearAllArgs) -> Self {
|
fn from(args: ClearAllArgs) -> Self {
|
||||||
Self::ClearAll
|
Self::ClearAll
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for ClearAllArgs {
|
impl __sdk::InModule for ClearAllArgs {
|
||||||
|
|
@ -37,7 +30,7 @@ pub trait clear_all {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_clear_all`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_clear_all`] callbacks.
|
||||||
fn clear_all(&self, ) -> __sdk::Result<()>;
|
fn clear_all(&self) -> __sdk::Result<()>;
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `clear_all`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `clear_all`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -45,34 +38,39 @@ pub trait clear_all {
|
||||||
///
|
///
|
||||||
/// The returned [`ClearAllCallbackId`] can be passed to [`Self::remove_on_clear_all`]
|
/// The returned [`ClearAllCallbackId`] can be passed to [`Self::remove_on_clear_all`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_clear_all(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> ClearAllCallbackId;
|
fn on_clear_all(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
|
) -> ClearAllCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_clear_all`],
|
/// Cancel a callback previously registered by [`Self::on_clear_all`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_clear_all(&self, callback: ClearAllCallbackId);
|
fn remove_on_clear_all(&self, callback: ClearAllCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl clear_all for super::RemoteReducers {
|
impl clear_all for super::RemoteReducers {
|
||||||
fn clear_all(&self, ) -> __sdk::Result<()> {
|
fn clear_all(&self) -> __sdk::Result<()> {
|
||||||
self.imp.call_reducer("clear_all", ClearAllArgs { })
|
self.imp.call_reducer("clear_all", ClearAllArgs {})
|
||||||
}
|
}
|
||||||
fn on_clear_all(
|
fn on_clear_all(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
) -> ClearAllCallbackId {
|
) -> ClearAllCallbackId {
|
||||||
ClearAllCallbackId(self.imp.on_reducer(
|
ClearAllCallbackId(self.imp.on_reducer(
|
||||||
"clear_all",
|
"clear_all",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::ClearAll {
|
__sdk::ReducerEvent {
|
||||||
|
reducer: super::Reducer::ClearAll {},
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -100,4 +98,3 @@ impl set_flags_for_clear_all for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("clear_all", flags);
|
self.imp.set_call_reducer_flags("clear_all", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,16 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub(super) struct ConnectArgs {
|
pub(super) struct ConnectArgs {}
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ConnectArgs> for super::Reducer {
|
impl From<ConnectArgs> for super::Reducer {
|
||||||
fn from(args: ConnectArgs) -> Self {
|
fn from(args: ConnectArgs) -> Self {
|
||||||
Self::Connect
|
Self::Connect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for ConnectArgs {
|
impl __sdk::InModule for ConnectArgs {
|
||||||
|
|
@ -37,7 +30,7 @@ pub trait connect {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_connect`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_connect`] callbacks.
|
||||||
fn connect(&self, ) -> __sdk::Result<()>;
|
fn connect(&self) -> __sdk::Result<()>;
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `connect`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `connect`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -45,34 +38,39 @@ pub trait connect {
|
||||||
///
|
///
|
||||||
/// The returned [`ConnectCallbackId`] can be passed to [`Self::remove_on_connect`]
|
/// The returned [`ConnectCallbackId`] can be passed to [`Self::remove_on_connect`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_connect(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> ConnectCallbackId;
|
fn on_connect(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
|
) -> ConnectCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_connect`],
|
/// Cancel a callback previously registered by [`Self::on_connect`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_connect(&self, callback: ConnectCallbackId);
|
fn remove_on_connect(&self, callback: ConnectCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl connect for super::RemoteReducers {
|
impl connect for super::RemoteReducers {
|
||||||
fn connect(&self, ) -> __sdk::Result<()> {
|
fn connect(&self) -> __sdk::Result<()> {
|
||||||
self.imp.call_reducer("connect", ConnectArgs { })
|
self.imp.call_reducer("connect", ConnectArgs {})
|
||||||
}
|
}
|
||||||
fn on_connect(
|
fn on_connect(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
) -> ConnectCallbackId {
|
) -> ConnectCallbackId {
|
||||||
ConnectCallbackId(self.imp.on_reducer(
|
ConnectCallbackId(self.imp.on_reducer(
|
||||||
"connect",
|
"connect",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::Connect {
|
__sdk::ReducerEvent {
|
||||||
|
reducer: super::Reducer::Connect {},
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -100,4 +98,3 @@ impl set_flags_for_connect for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("connect", flags);
|
self.imp.set_call_reducer_flags("connect", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::tile_type::Tile;
|
use super::tile_type::Tile;
|
||||||
|
|
||||||
|
|
@ -18,8 +13,6 @@ pub struct DbTile {
|
||||||
pub tile: Tile,
|
pub tile: Tile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for DbTile {
|
impl __sdk::InModule for DbTile {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
|
|
||||||
|
|
@ -15,11 +10,9 @@ use super::db_tile_type::DbTile;
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub struct DbWall {
|
pub struct DbWall {
|
||||||
pub lobby_id: u32,
|
pub lobby_id: u32,
|
||||||
pub tiles: Vec::<DbTile>,
|
pub tiles: Vec<DbTile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for DbWall {
|
impl __sdk::InModule for DbWall {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -20,8 +14,8 @@ impl From<DiscardTileArgs> for super::Reducer {
|
||||||
fn from(args: DiscardTileArgs) -> Self {
|
fn from(args: DiscardTileArgs) -> Self {
|
||||||
Self::DiscardTile {
|
Self::DiscardTile {
|
||||||
tile_id: args.tile_id,
|
tile_id: args.tile_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for DiscardTileArgs {
|
impl __sdk::InModule for DiscardTileArgs {
|
||||||
|
|
@ -40,8 +34,7 @@ pub trait discard_tile {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_discard_tile`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_discard_tile`] callbacks.
|
||||||
fn discard_tile(&self, tile_id: u32,
|
fn discard_tile(&self, tile_id: u32) -> __sdk::Result<()>;
|
||||||
) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `discard_tile`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `discard_tile`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -49,35 +42,40 @@ pub trait discard_tile {
|
||||||
///
|
///
|
||||||
/// The returned [`DiscardTileCallbackId`] can be passed to [`Self::remove_on_discard_tile`]
|
/// The returned [`DiscardTileCallbackId`] can be passed to [`Self::remove_on_discard_tile`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_discard_tile(&self, callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static) -> DiscardTileCallbackId;
|
fn on_discard_tile(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
|
) -> DiscardTileCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_discard_tile`],
|
/// Cancel a callback previously registered by [`Self::on_discard_tile`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_discard_tile(&self, callback: DiscardTileCallbackId);
|
fn remove_on_discard_tile(&self, callback: DiscardTileCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl discard_tile for super::RemoteReducers {
|
impl discard_tile for super::RemoteReducers {
|
||||||
fn discard_tile(&self, tile_id: u32,
|
fn discard_tile(&self, tile_id: u32) -> __sdk::Result<()> {
|
||||||
) -> __sdk::Result<()> {
|
self.imp
|
||||||
self.imp.call_reducer("discard_tile", DiscardTileArgs { tile_id, })
|
.call_reducer("discard_tile", DiscardTileArgs { tile_id })
|
||||||
}
|
}
|
||||||
fn on_discard_tile(
|
fn on_discard_tile(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
) -> DiscardTileCallbackId {
|
) -> DiscardTileCallbackId {
|
||||||
DiscardTileCallbackId(self.imp.on_reducer(
|
DiscardTileCallbackId(self.imp.on_reducer(
|
||||||
"discard_tile",
|
"discard_tile",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::DiscardTile {
|
__sdk::ReducerEvent {
|
||||||
tile_id,
|
reducer: super::Reducer::DiscardTile { tile_id },
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, tile_id, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx, tile_id)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -105,4 +103,3 @@ impl set_flags_for_discard_tile for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("discard_tile", flags);
|
self.imp.set_call_reducer_flags("discard_tile", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,16 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub(super) struct DisconnectArgs {
|
pub(super) struct DisconnectArgs {}
|
||||||
}
|
|
||||||
|
|
||||||
impl From<DisconnectArgs> for super::Reducer {
|
impl From<DisconnectArgs> for super::Reducer {
|
||||||
fn from(args: DisconnectArgs) -> Self {
|
fn from(args: DisconnectArgs) -> Self {
|
||||||
Self::Disconnect
|
Self::Disconnect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for DisconnectArgs {
|
impl __sdk::InModule for DisconnectArgs {
|
||||||
|
|
@ -37,7 +30,7 @@ pub trait disconnect {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_disconnect`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_disconnect`] callbacks.
|
||||||
fn disconnect(&self, ) -> __sdk::Result<()>;
|
fn disconnect(&self) -> __sdk::Result<()>;
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `disconnect`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `disconnect`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -45,34 +38,39 @@ pub trait disconnect {
|
||||||
///
|
///
|
||||||
/// The returned [`DisconnectCallbackId`] can be passed to [`Self::remove_on_disconnect`]
|
/// The returned [`DisconnectCallbackId`] can be passed to [`Self::remove_on_disconnect`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_disconnect(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> DisconnectCallbackId;
|
fn on_disconnect(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
|
) -> DisconnectCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_disconnect`],
|
/// Cancel a callback previously registered by [`Self::on_disconnect`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_disconnect(&self, callback: DisconnectCallbackId);
|
fn remove_on_disconnect(&self, callback: DisconnectCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl disconnect for super::RemoteReducers {
|
impl disconnect for super::RemoteReducers {
|
||||||
fn disconnect(&self, ) -> __sdk::Result<()> {
|
fn disconnect(&self) -> __sdk::Result<()> {
|
||||||
self.imp.call_reducer("disconnect", DisconnectArgs { })
|
self.imp.call_reducer("disconnect", DisconnectArgs {})
|
||||||
}
|
}
|
||||||
fn on_disconnect(
|
fn on_disconnect(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
||||||
) -> DisconnectCallbackId {
|
) -> DisconnectCallbackId {
|
||||||
DisconnectCallbackId(self.imp.on_reducer(
|
DisconnectCallbackId(self.imp.on_reducer(
|
||||||
"disconnect",
|
"disconnect",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::Disconnect {
|
__sdk::ReducerEvent {
|
||||||
|
reducer: super::Reducer::Disconnect {},
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -100,4 +98,3 @@ impl set_flags_for_disconnect for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("disconnect", flags);
|
self.imp.set_call_reducer_flags("disconnect", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -18,12 +13,8 @@ pub enum Dragon {
|
||||||
Hatsu,
|
Hatsu,
|
||||||
|
|
||||||
Chun,
|
Chun,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Dragon {
|
impl __sdk::InModule for Dragon {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub(super) struct DrawTileArgs {}
|
|
||||||
|
|
||||||
impl From<DrawTileArgs> for super::Reducer {
|
|
||||||
fn from(args: DrawTileArgs) -> Self {
|
|
||||||
Self::DrawTile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for DrawTileArgs {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct DrawTileCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the reducer `draw_tile`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteReducers`].
|
|
||||||
pub trait draw_tile {
|
|
||||||
/// Request that the remote module invoke the reducer `draw_tile` to run as soon as possible.
|
|
||||||
///
|
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
|
||||||
/// The reducer will run asynchronously in the future,
|
|
||||||
/// and its status can be observed by listening for [`Self::on_draw_tile`] callbacks.
|
|
||||||
fn draw_tile(&self) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `draw_tile`.
|
|
||||||
///
|
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
||||||
/// to determine the reducer's status.
|
|
||||||
///
|
|
||||||
/// The returned [`DrawTileCallbackId`] can be passed to [`Self::remove_on_draw_tile`]
|
|
||||||
/// to cancel the callback.
|
|
||||||
fn on_draw_tile(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> DrawTileCallbackId;
|
|
||||||
/// Cancel a callback previously registered by [`Self::on_draw_tile`],
|
|
||||||
/// causing it not to run in the future.
|
|
||||||
fn remove_on_draw_tile(&self, callback: DrawTileCallbackId);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl draw_tile for super::RemoteReducers {
|
|
||||||
fn draw_tile(&self) -> __sdk::Result<()> {
|
|
||||||
self.imp.call_reducer("draw_tile", DrawTileArgs {})
|
|
||||||
}
|
|
||||||
fn on_draw_tile(
|
|
||||||
&self,
|
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> DrawTileCallbackId {
|
|
||||||
DrawTileCallbackId(self.imp.on_reducer(
|
|
||||||
"draw_tile",
|
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
||||||
#[allow(irrefutable_let_patterns)]
|
|
||||||
let super::ReducerEventContext {
|
|
||||||
event:
|
|
||||||
__sdk::ReducerEvent {
|
|
||||||
reducer: super::Reducer::DrawTile {},
|
|
||||||
..
|
|
||||||
},
|
|
||||||
..
|
|
||||||
} = ctx
|
|
||||||
else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
callback(ctx)
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn remove_on_draw_tile(&self, callback: DrawTileCallbackId) {
|
|
||||||
self.imp.remove_on_reducer("draw_tile", callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Extension trait for setting the call-flags for the reducer `draw_tile`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::SetReducerFlags`].
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
pub trait set_flags_for_draw_tile {
|
|
||||||
/// Set the call-reducer flags for the reducer `draw_tile` to `flags`.
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
fn draw_tile(&self, flags: __ws::CallReducerFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl set_flags_for_draw_tile for super::SetReducerFlags {
|
|
||||||
fn draw_tile(&self, flags: __ws::CallReducerFlags) {
|
|
||||||
self.imp.set_call_reducer_flags("draw_tile", flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -24,12 +19,8 @@ pub enum GameState {
|
||||||
Play,
|
Play,
|
||||||
|
|
||||||
Exit,
|
Exit,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for GameState {
|
impl __sdk::InModule for GameState {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::game_timer_type::GameTimer;
|
use super::game_timer_type::GameTimer;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `game_timer`.
|
/// Table handle for the table `game_timer`.
|
||||||
///
|
///
|
||||||
|
|
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> {
|
||||||
type Row = GameTimer;
|
type Row = GameTimer;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = GameTimer> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = GameTimer> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = GameTimerInsertCallbackId;
|
type InsertCallbackId = GameTimerInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -81,7 +80,6 @@ impl<'ctx> __sdk::Table for GameTimerTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<GameTimer>("game_timer");
|
let _table = client_cache.get_or_make_table::<GameTimer>("game_timer");
|
||||||
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
_table.add_unique_constraint::<u64>("id", |row| &row.id);
|
||||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for GameTimerTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<GameTimer>> {
|
) -> __sdk::Result<__sdk::TableUpdate<GameTimer>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<GameTimer>", "TableUpdate")
|
||||||
"TableUpdate<GameTimer>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `game_timer`,
|
/// Access to the `id` unique index on the table `game_timer`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`GameTimerIdUnique::find`] method.
|
/// via the [`GameTimerIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.game_timer().id().find(...)`.
|
/// like `ctx.db.game_timer().id().find(...)`.
|
||||||
pub struct GameTimerIdUnique<'ctx> {
|
pub struct GameTimerIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<GameTimer, u64>,
|
imp: __sdk::UniqueConstraintHandle<GameTimer, u64>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> GameTimerTableHandle<'ctx> {
|
impl<'ctx> GameTimerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `game_timer`.
|
/// Get a handle on the `id` unique index on the table `game_timer`.
|
||||||
pub fn id(&self) -> GameTimerIdUnique<'ctx> {
|
pub fn id(&self) -> GameTimerIdUnique<'ctx> {
|
||||||
GameTimerIdUnique {
|
GameTimerIdUnique {
|
||||||
|
|
@ -136,29 +132,29 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> GameTimerIdUnique<'ctx> {
|
impl<'ctx> GameTimerIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u64) -> Option<GameTimer> {
|
pub fn find(&self, col_val: &u64) -> Option<GameTimer> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `lobby_id` unique index on the table `game_timer`,
|
/// Access to the `lobby_id` unique index on the table `game_timer`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`GameTimerLobbyIdUnique::find`] method.
|
/// via the [`GameTimerLobbyIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.game_timer().lobby_id().find(...)`.
|
/// like `ctx.db.game_timer().lobby_id().find(...)`.
|
||||||
pub struct GameTimerLobbyIdUnique<'ctx> {
|
pub struct GameTimerLobbyIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<GameTimer, u32>,
|
imp: __sdk::UniqueConstraintHandle<GameTimer, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> GameTimerTableHandle<'ctx> {
|
impl<'ctx> GameTimerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `lobby_id` unique index on the table `game_timer`.
|
/// Get a handle on the `lobby_id` unique index on the table `game_timer`.
|
||||||
pub fn lobby_id(&self) -> GameTimerLobbyIdUnique<'ctx> {
|
pub fn lobby_id(&self) -> GameTimerLobbyIdUnique<'ctx> {
|
||||||
GameTimerLobbyIdUnique {
|
GameTimerLobbyIdUnique {
|
||||||
|
|
@ -166,13 +162,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> GameTimerLobbyIdUnique<'ctx> {
|
impl<'ctx> GameTimerLobbyIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `lobby_id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `lobby_id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<GameTimer> {
|
pub fn find(&self, col_val: &u32) -> Option<GameTimer> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -18,8 +12,6 @@ pub struct GameTimer {
|
||||||
pub scheduled_at: __sdk::ScheduleAt,
|
pub scheduled_at: __sdk::ScheduleAt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for GameTimer {
|
impl __sdk::InModule for GameTimer {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -20,8 +14,8 @@ impl From<JoinOrCreateLobbyArgs> for super::Reducer {
|
||||||
fn from(args: JoinOrCreateLobbyArgs) -> Self {
|
fn from(args: JoinOrCreateLobbyArgs) -> Self {
|
||||||
Self::JoinOrCreateLobby {
|
Self::JoinOrCreateLobby {
|
||||||
lobby_id: args.lobby_id,
|
lobby_id: args.lobby_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for JoinOrCreateLobbyArgs {
|
impl __sdk::InModule for JoinOrCreateLobbyArgs {
|
||||||
|
|
@ -40,8 +34,7 @@ pub trait join_or_create_lobby {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_join_or_create_lobby`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_join_or_create_lobby`] callbacks.
|
||||||
fn join_or_create_lobby(&self, lobby_id: u32,
|
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()>;
|
||||||
) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `join_or_create_lobby`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `join_or_create_lobby`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -49,40 +42,46 @@ pub trait join_or_create_lobby {
|
||||||
///
|
///
|
||||||
/// The returned [`JoinOrCreateLobbyCallbackId`] can be passed to [`Self::remove_on_join_or_create_lobby`]
|
/// The returned [`JoinOrCreateLobbyCallbackId`] can be passed to [`Self::remove_on_join_or_create_lobby`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_join_or_create_lobby(&self, callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static) -> JoinOrCreateLobbyCallbackId;
|
fn on_join_or_create_lobby(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
|
) -> JoinOrCreateLobbyCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_join_or_create_lobby`],
|
/// Cancel a callback previously registered by [`Self::on_join_or_create_lobby`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId);
|
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl join_or_create_lobby for super::RemoteReducers {
|
impl join_or_create_lobby for super::RemoteReducers {
|
||||||
fn join_or_create_lobby(&self, lobby_id: u32,
|
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()> {
|
||||||
) -> __sdk::Result<()> {
|
self.imp
|
||||||
self.imp.call_reducer("join_or_create_lobby", JoinOrCreateLobbyArgs { lobby_id, })
|
.call_reducer("join_or_create_lobby", JoinOrCreateLobbyArgs { lobby_id })
|
||||||
}
|
}
|
||||||
fn on_join_or_create_lobby(
|
fn on_join_or_create_lobby(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
||||||
) -> JoinOrCreateLobbyCallbackId {
|
) -> JoinOrCreateLobbyCallbackId {
|
||||||
JoinOrCreateLobbyCallbackId(self.imp.on_reducer(
|
JoinOrCreateLobbyCallbackId(self.imp.on_reducer(
|
||||||
"join_or_create_lobby",
|
"join_or_create_lobby",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::JoinOrCreateLobby {
|
__sdk::ReducerEvent {
|
||||||
lobby_id,
|
reducer: super::Reducer::JoinOrCreateLobby { lobby_id },
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, lobby_id, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx, lobby_id)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId) {
|
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId) {
|
||||||
self.imp.remove_on_reducer("join_or_create_lobby", callback.0)
|
self.imp
|
||||||
|
.remove_on_reducer("join_or_create_lobby", callback.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +101,7 @@ pub trait set_flags_for_join_or_create_lobby {
|
||||||
|
|
||||||
impl set_flags_for_join_or_create_lobby for super::SetReducerFlags {
|
impl set_flags_for_join_or_create_lobby for super::SetReducerFlags {
|
||||||
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags) {
|
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags) {
|
||||||
self.imp.set_call_reducer_flags("join_or_create_lobby", flags);
|
self.imp
|
||||||
|
.set_call_reducer_flags("join_or_create_lobby", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use super::game_state_type::GameState;
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::lobby_type::Lobby;
|
use super::lobby_type::Lobby;
|
||||||
use super::player_or_bot_type::PlayerOrBot;
|
use super::player_or_bot_type::PlayerOrBot;
|
||||||
use super::game_state_type::GameState;
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `lobby`.
|
/// Table handle for the table `lobby`.
|
||||||
///
|
///
|
||||||
|
|
@ -51,8 +46,12 @@ impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> {
|
||||||
type Row = Lobby;
|
type Row = Lobby;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = Lobby> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = Lobby> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = LobbyInsertCallbackId;
|
type InsertCallbackId = LobbyInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -83,7 +82,6 @@ impl<'ctx> __sdk::Table for LobbyTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<Lobby>("lobby");
|
let _table = client_cache.get_or_make_table::<Lobby>("lobby");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
}
|
}
|
||||||
|
|
@ -104,32 +102,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for LobbyTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<Lobby>> {
|
) -> __sdk::Result<__sdk::TableUpdate<Lobby>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<Lobby>", "TableUpdate")
|
||||||
"TableUpdate<Lobby>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `lobby`,
|
/// Access to the `id` unique index on the table `lobby`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`LobbyIdUnique::find`] method.
|
/// via the [`LobbyIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.lobby().id().find(...)`.
|
/// like `ctx.db.lobby().id().find(...)`.
|
||||||
pub struct LobbyIdUnique<'ctx> {
|
pub struct LobbyIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Lobby, u32>,
|
imp: __sdk::UniqueConstraintHandle<Lobby, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LobbyTableHandle<'ctx> {
|
impl<'ctx> LobbyTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `lobby`.
|
/// Get a handle on the `id` unique index on the table `lobby`.
|
||||||
pub fn id(&self) -> LobbyIdUnique<'ctx> {
|
pub fn id(&self) -> LobbyIdUnique<'ctx> {
|
||||||
LobbyIdUnique {
|
LobbyIdUnique {
|
||||||
|
|
@ -137,13 +133,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LobbyIdUnique<'ctx> {
|
impl<'ctx> LobbyIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<Lobby> {
|
pub fn find(&self, col_val: &u32) -> Option<Lobby> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,21 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::player_or_bot_type::PlayerOrBot;
|
|
||||||
use super::game_state_type::GameState;
|
use super::game_state_type::GameState;
|
||||||
|
use super::player_or_bot_type::PlayerOrBot;
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub struct Lobby {
|
pub struct Lobby {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
pub players: Vec::<PlayerOrBot>,
|
pub players: Vec<PlayerOrBot>,
|
||||||
pub dealer_idx: u8,
|
pub dealer_idx: u8,
|
||||||
pub current_idx: u8,
|
pub current_idx: u8,
|
||||||
pub game_state: GameState,
|
pub game_state: GameState,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Lobby {
|
impl __sdk::InModule for Lobby {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::player_type::Player;
|
use super::player_type::Player;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `logged_out_player`.
|
/// Table handle for the table `logged_out_player`.
|
||||||
///
|
///
|
||||||
|
|
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> {
|
||||||
type Row = Player;
|
type Row = Player;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = Player> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = Player> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = LoggedOutPlayerInsertCallbackId;
|
type InsertCallbackId = LoggedOutPlayerInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -81,7 +80,6 @@ impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<Player>("logged_out_player");
|
let _table = client_cache.get_or_make_table::<Player>("logged_out_player");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for LoggedOutPlayerTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||||
"TableUpdate<Player>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `logged_out_player`,
|
/// Access to the `id` unique index on the table `logged_out_player`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`LoggedOutPlayerIdUnique::find`] method.
|
/// via the [`LoggedOutPlayerIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.logged_out_player().id().find(...)`.
|
/// like `ctx.db.logged_out_player().id().find(...)`.
|
||||||
pub struct LoggedOutPlayerIdUnique<'ctx> {
|
pub struct LoggedOutPlayerIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `logged_out_player`.
|
/// Get a handle on the `id` unique index on the table `logged_out_player`.
|
||||||
pub fn id(&self) -> LoggedOutPlayerIdUnique<'ctx> {
|
pub fn id(&self) -> LoggedOutPlayerIdUnique<'ctx> {
|
||||||
LoggedOutPlayerIdUnique {
|
LoggedOutPlayerIdUnique {
|
||||||
|
|
@ -136,43 +132,44 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LoggedOutPlayerIdUnique<'ctx> {
|
impl<'ctx> LoggedOutPlayerIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<Player> {
|
pub fn find(&self, col_val: &u32) -> Option<Player> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `identity` unique index on the table `logged_out_player`,
|
/// Access to the `identity` unique index on the table `logged_out_player`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`LoggedOutPlayerIdentityUnique::find`] method.
|
/// via the [`LoggedOutPlayerIdentityUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.logged_out_player().identity().find(...)`.
|
/// like `ctx.db.logged_out_player().identity().find(...)`.
|
||||||
pub struct LoggedOutPlayerIdentityUnique<'ctx> {
|
pub struct LoggedOutPlayerIdentityUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
impl<'ctx> LoggedOutPlayerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `identity` unique index on the table `logged_out_player`.
|
/// Get a handle on the `identity` unique index on the table `logged_out_player`.
|
||||||
pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> {
|
pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> {
|
||||||
LoggedOutPlayerIdentityUnique {
|
LoggedOutPlayerIdentityUnique {
|
||||||
imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"),
|
imp: self
|
||||||
|
.imp
|
||||||
|
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> {
|
impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
|
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
|
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub(super) struct LoginOrAddPlayerArgs {}
|
|
||||||
|
|
||||||
impl From<LoginOrAddPlayerArgs> for super::Reducer {
|
|
||||||
fn from(args: LoginOrAddPlayerArgs) -> Self {
|
|
||||||
Self::LoginOrAddPlayer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for LoginOrAddPlayerArgs {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct LoginOrAddPlayerCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the reducer `login_or_add_player`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteReducers`].
|
|
||||||
pub trait login_or_add_player {
|
|
||||||
/// Request that the remote module invoke the reducer `login_or_add_player` to run as soon as possible.
|
|
||||||
///
|
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
|
||||||
/// The reducer will run asynchronously in the future,
|
|
||||||
/// and its status can be observed by listening for [`Self::on_login_or_add_player`] callbacks.
|
|
||||||
fn login_or_add_player(&self) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `login_or_add_player`.
|
|
||||||
///
|
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
||||||
/// to determine the reducer's status.
|
|
||||||
///
|
|
||||||
/// The returned [`LoginOrAddPlayerCallbackId`] can be passed to [`Self::remove_on_login_or_add_player`]
|
|
||||||
/// to cancel the callback.
|
|
||||||
fn on_login_or_add_player(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> LoginOrAddPlayerCallbackId;
|
|
||||||
/// Cancel a callback previously registered by [`Self::on_login_or_add_player`],
|
|
||||||
/// causing it not to run in the future.
|
|
||||||
fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl login_or_add_player for super::RemoteReducers {
|
|
||||||
fn login_or_add_player(&self) -> __sdk::Result<()> {
|
|
||||||
self.imp
|
|
||||||
.call_reducer("login_or_add_player", LoginOrAddPlayerArgs {})
|
|
||||||
}
|
|
||||||
fn on_login_or_add_player(
|
|
||||||
&self,
|
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> LoginOrAddPlayerCallbackId {
|
|
||||||
LoginOrAddPlayerCallbackId(self.imp.on_reducer(
|
|
||||||
"login_or_add_player",
|
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
||||||
#[allow(irrefutable_let_patterns)]
|
|
||||||
let super::ReducerEventContext {
|
|
||||||
event:
|
|
||||||
__sdk::ReducerEvent {
|
|
||||||
reducer: super::Reducer::LoginOrAddPlayer {},
|
|
||||||
..
|
|
||||||
},
|
|
||||||
..
|
|
||||||
} = ctx
|
|
||||||
else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
callback(ctx)
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId) {
|
|
||||||
self.imp
|
|
||||||
.remove_on_reducer("login_or_add_player", callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Extension trait for setting the call-flags for the reducer `login_or_add_player`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::SetReducerFlags`].
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
pub trait set_flags_for_login_or_add_player {
|
|
||||||
/// Set the call-reducer flags for the reducer `login_or_add_player` to `flags`.
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
fn login_or_add_player(&self, flags: __ws::CallReducerFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl set_flags_for_login_or_add_player for super::SetReducerFlags {
|
|
||||||
fn login_or_add_player(&self, flags: __ws::CallReducerFlags) {
|
|
||||||
self.imp
|
|
||||||
.set_call_reducer_flags("login_or_add_player", flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,80 +4,77 @@
|
||||||
// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094).
|
// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094).
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub mod bot_type;
|
|
||||||
pub mod db_tile_type;
|
|
||||||
pub mod db_wall_type;
|
|
||||||
pub mod dragon_type;
|
|
||||||
pub mod game_state_type;
|
|
||||||
pub mod game_timer_type;
|
|
||||||
pub mod lobby_type;
|
|
||||||
pub mod player_type;
|
|
||||||
pub mod player_clock_type;
|
|
||||||
pub mod player_hand_type;
|
|
||||||
pub mod player_or_bot_type;
|
|
||||||
pub mod rank_type;
|
|
||||||
pub mod suit_type;
|
|
||||||
pub mod tile_type;
|
|
||||||
pub mod turn_state_type;
|
|
||||||
pub mod wind_type;
|
|
||||||
pub mod add_bot_reducer;
|
pub mod add_bot_reducer;
|
||||||
pub mod advance_game_reducer;
|
pub mod advance_game_reducer;
|
||||||
|
pub mod bot_table;
|
||||||
|
pub mod bot_type;
|
||||||
pub mod clear_all_reducer;
|
pub mod clear_all_reducer;
|
||||||
pub mod connect_reducer;
|
pub mod connect_reducer;
|
||||||
|
pub mod db_tile_type;
|
||||||
|
pub mod db_wall_type;
|
||||||
pub mod discard_tile_reducer;
|
pub mod discard_tile_reducer;
|
||||||
pub mod disconnect_reducer;
|
pub mod disconnect_reducer;
|
||||||
pub mod join_or_create_lobby_reducer;
|
pub mod dragon_type;
|
||||||
pub mod set_ready_reducer;
|
pub mod game_state_type;
|
||||||
pub mod bot_table;
|
|
||||||
pub mod game_timer_table;
|
pub mod game_timer_table;
|
||||||
|
pub mod game_timer_type;
|
||||||
|
pub mod join_or_create_lobby_reducer;
|
||||||
pub mod lobby_table;
|
pub mod lobby_table;
|
||||||
|
pub mod lobby_type;
|
||||||
pub mod logged_out_player_table;
|
pub mod logged_out_player_table;
|
||||||
pub mod player_table;
|
|
||||||
pub mod player_clock_table;
|
pub mod player_clock_table;
|
||||||
|
pub mod player_clock_type;
|
||||||
pub mod player_hand_table;
|
pub mod player_hand_table;
|
||||||
|
pub mod player_hand_type;
|
||||||
|
pub mod player_or_bot_type;
|
||||||
|
pub mod player_table;
|
||||||
|
pub mod player_type;
|
||||||
|
pub mod rank_type;
|
||||||
|
pub mod set_ready_reducer;
|
||||||
|
pub mod suit_type;
|
||||||
pub mod tile_table;
|
pub mod tile_table;
|
||||||
|
pub mod tile_type;
|
||||||
|
pub mod turn_state_type;
|
||||||
pub mod wall_table;
|
pub mod wall_table;
|
||||||
|
pub mod wind_type;
|
||||||
|
|
||||||
pub use bot_type::Bot;
|
|
||||||
pub use db_tile_type::DbTile;
|
|
||||||
pub use db_wall_type::DbWall;
|
|
||||||
pub use dragon_type::Dragon;
|
|
||||||
pub use game_state_type::GameState;
|
|
||||||
pub use game_timer_type::GameTimer;
|
|
||||||
pub use lobby_type::Lobby;
|
|
||||||
pub use player_type::Player;
|
|
||||||
pub use player_clock_type::PlayerClock;
|
|
||||||
pub use player_hand_type::PlayerHand;
|
|
||||||
pub use player_or_bot_type::PlayerOrBot;
|
|
||||||
pub use rank_type::Rank;
|
|
||||||
pub use suit_type::Suit;
|
|
||||||
pub use tile_type::Tile;
|
|
||||||
pub use turn_state_type::TurnState;
|
|
||||||
pub use wind_type::Wind;
|
|
||||||
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 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 advance_game_reducer::{advance_game, set_flags_for_advance_game, AdvanceGameCallbackId};
|
||||||
|
pub use bot_table::*;
|
||||||
|
pub use bot_type::Bot;
|
||||||
pub use clear_all_reducer::{clear_all, set_flags_for_clear_all, ClearAllCallbackId};
|
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 connect_reducer::{connect, set_flags_for_connect, ConnectCallbackId};
|
||||||
|
pub use db_tile_type::DbTile;
|
||||||
|
pub use db_wall_type::DbWall;
|
||||||
pub use discard_tile_reducer::{discard_tile, set_flags_for_discard_tile, DiscardTileCallbackId};
|
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 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 dragon_type::Dragon;
|
||||||
pub use set_ready_reducer::{set_ready, set_flags_for_set_ready, SetReadyCallbackId};
|
pub use game_state_type::GameState;
|
||||||
|
pub use game_timer_table::*;
|
||||||
|
pub use game_timer_type::GameTimer;
|
||||||
|
pub use join_or_create_lobby_reducer::{
|
||||||
|
join_or_create_lobby, set_flags_for_join_or_create_lobby, JoinOrCreateLobbyCallbackId,
|
||||||
|
};
|
||||||
|
pub use lobby_table::*;
|
||||||
|
pub use lobby_type::Lobby;
|
||||||
|
pub use logged_out_player_table::*;
|
||||||
|
pub use player_clock_table::*;
|
||||||
|
pub use player_clock_type::PlayerClock;
|
||||||
|
pub use player_hand_table::*;
|
||||||
|
pub use player_hand_type::PlayerHand;
|
||||||
|
pub use player_or_bot_type::PlayerOrBot;
|
||||||
|
pub use player_table::*;
|
||||||
|
pub use player_type::Player;
|
||||||
|
pub use rank_type::Rank;
|
||||||
|
pub use set_ready_reducer::{set_flags_for_set_ready, set_ready, SetReadyCallbackId};
|
||||||
|
pub use suit_type::Suit;
|
||||||
|
pub use tile_table::*;
|
||||||
|
pub use tile_type::Tile;
|
||||||
|
pub use turn_state_type::TurnState;
|
||||||
|
pub use wall_table::*;
|
||||||
|
pub use wind_type::Wind;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
|
|
||||||
|
|
@ -87,27 +84,16 @@ pub use set_ready_reducer::{set_ready, set_flags_for_set_ready, SetReadyCallback
|
||||||
/// to indicate which reducer caused the event.
|
/// to indicate which reducer caused the event.
|
||||||
|
|
||||||
pub enum Reducer {
|
pub enum Reducer {
|
||||||
AddBot {
|
AddBot { lobby_id: u32 },
|
||||||
lobby_id: u32,
|
AdvanceGame { game_timer: GameTimer },
|
||||||
} ,
|
ClearAll,
|
||||||
AdvanceGame {
|
Connect,
|
||||||
game_timer: GameTimer,
|
DiscardTile { tile_id: u32 },
|
||||||
} ,
|
Disconnect,
|
||||||
ClearAll ,
|
JoinOrCreateLobby { lobby_id: u32 },
|
||||||
Connect ,
|
SetReady { ready: bool },
|
||||||
DiscardTile {
|
|
||||||
tile_id: u32,
|
|
||||||
} ,
|
|
||||||
Disconnect ,
|
|
||||||
JoinOrCreateLobby {
|
|
||||||
lobby_id: u32,
|
|
||||||
} ,
|
|
||||||
SetReady {
|
|
||||||
ready: bool,
|
|
||||||
} ,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Reducer {
|
impl __sdk::InModule for Reducer {
|
||||||
type Module = RemoteModule;
|
type Module = RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
@ -124,24 +110,70 @@ impl __sdk::Reducer for Reducer {
|
||||||
Reducer::JoinOrCreateLobby { .. } => "join_or_create_lobby",
|
Reducer::JoinOrCreateLobby { .. } => "join_or_create_lobby",
|
||||||
Reducer::SetReady { .. } => "set_ready",
|
Reducer::SetReady { .. } => "set_ready",
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer {
|
impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer {
|
||||||
type Error = __sdk::Error;
|
type Error = __sdk::Error;
|
||||||
fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result<Self> {
|
fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result<Self> {
|
||||||
match &value.reducer_name[..] {
|
match &value.reducer_name[..] {
|
||||||
"add_bot" => Ok(__sdk::parse_reducer_args::<add_bot_reducer::AddBotArgs>("add_bot", &value.args)?.into()),
|
"add_bot" => Ok(__sdk::parse_reducer_args::<add_bot_reducer::AddBotArgs>(
|
||||||
"advance_game" => Ok(__sdk::parse_reducer_args::<advance_game_reducer::AdvanceGameArgs>("advance_game", &value.args)?.into()),
|
"add_bot",
|
||||||
"clear_all" => Ok(__sdk::parse_reducer_args::<clear_all_reducer::ClearAllArgs>("clear_all", &value.args)?.into()),
|
&value.args,
|
||||||
"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()),
|
.into()),
|
||||||
"disconnect" => Ok(__sdk::parse_reducer_args::<disconnect_reducer::DisconnectArgs>("disconnect", &value.args)?.into()),
|
"advance_game" => Ok(
|
||||||
"join_or_create_lobby" => Ok(__sdk::parse_reducer_args::<join_or_create_lobby_reducer::JoinOrCreateLobbyArgs>("join_or_create_lobby", &value.args)?.into()),
|
__sdk::parse_reducer_args::<advance_game_reducer::AdvanceGameArgs>(
|
||||||
"set_ready" => Ok(__sdk::parse_reducer_args::<set_ready_reducer::SetReadyArgs>("set_ready", &value.args)?.into()),
|
"advance_game",
|
||||||
unknown => Err(__sdk::InternalError::unknown_name("reducer", unknown, "ReducerCallInfo").into()),
|
&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(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
@ -159,30 +191,47 @@ pub struct DbUpdate {
|
||||||
wall: __sdk::TableUpdate<DbWall>,
|
wall: __sdk::TableUpdate<DbWall>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
|
impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate {
|
||||||
type Error = __sdk::Error;
|
type Error = __sdk::Error;
|
||||||
fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result<Self, Self::Error> {
|
fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result<Self, Self::Error> {
|
||||||
let mut db_update = DbUpdate::default();
|
let mut db_update = DbUpdate::default();
|
||||||
for table_update in raw.tables {
|
for table_update in raw.tables {
|
||||||
match &table_update.table_name[..] {
|
match &table_update.table_name[..] {
|
||||||
|
"bot" => db_update
|
||||||
"bot" => db_update.bot.append(bot_table::parse_table_update(table_update)?),
|
.bot
|
||||||
"game_timer" => db_update.game_timer.append(game_timer_table::parse_table_update(table_update)?),
|
.append(bot_table::parse_table_update(table_update)?),
|
||||||
"lobby" => db_update.lobby.append(lobby_table::parse_table_update(table_update)?),
|
"game_timer" => db_update
|
||||||
"logged_out_player" => db_update.logged_out_player.append(logged_out_player_table::parse_table_update(table_update)?),
|
.game_timer
|
||||||
"player" => db_update.player.append(player_table::parse_table_update(table_update)?),
|
.append(game_timer_table::parse_table_update(table_update)?),
|
||||||
"player_clock" => db_update.player_clock.append(player_clock_table::parse_table_update(table_update)?),
|
"lobby" => db_update
|
||||||
"player_hand" => db_update.player_hand.append(player_hand_table::parse_table_update(table_update)?),
|
.lobby
|
||||||
"tile" => db_update.tile.append(tile_table::parse_table_update(table_update)?),
|
.append(lobby_table::parse_table_update(table_update)?),
|
||||||
"wall" => db_update.wall.append(wall_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)?),
|
||||||
|
|
||||||
unknown => {
|
unknown => {
|
||||||
return Err(__sdk::InternalError::unknown_name(
|
return Err(__sdk::InternalError::unknown_name(
|
||||||
"table",
|
"table",
|
||||||
unknown,
|
unknown,
|
||||||
"DatabaseUpdate",
|
"DatabaseUpdate",
|
||||||
).into());
|
)
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -195,18 +244,39 @@ impl __sdk::InModule for DbUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::DbUpdate for DbUpdate {
|
impl __sdk::DbUpdate for DbUpdate {
|
||||||
fn apply_to_client_cache(&self, cache: &mut __sdk::ClientCache<RemoteModule>) -> AppliedDiff<'_> {
|
fn apply_to_client_cache(
|
||||||
|
&self,
|
||||||
|
cache: &mut __sdk::ClientCache<RemoteModule>,
|
||||||
|
) -> AppliedDiff<'_> {
|
||||||
let mut diff = AppliedDiff::default();
|
let mut diff = AppliedDiff::default();
|
||||||
|
|
||||||
diff.bot = cache.apply_diff_to_table::<Bot>("bot", &self.bot).with_updates_by_pk(|row| &row.id);
|
diff.bot = cache
|
||||||
diff.game_timer = cache.apply_diff_to_table::<GameTimer>("game_timer", &self.game_timer).with_updates_by_pk(|row| &row.id);
|
.apply_diff_to_table::<Bot>("bot", &self.bot)
|
||||||
diff.lobby = cache.apply_diff_to_table::<Lobby>("lobby", &self.lobby).with_updates_by_pk(|row| &row.id);
|
.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.game_timer = cache
|
||||||
diff.player = cache.apply_diff_to_table::<Player>("player", &self.player).with_updates_by_pk(|row| &row.identity);
|
.apply_diff_to_table::<GameTimer>("game_timer", &self.game_timer)
|
||||||
diff.player_clock = cache.apply_diff_to_table::<PlayerClock>("player_clock", &self.player_clock).with_updates_by_pk(|row| &row.id);
|
.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.lobby = cache
|
||||||
diff.tile = cache.apply_diff_to_table::<DbTile>("tile", &self.tile).with_updates_by_pk(|row| &row.id);
|
.apply_diff_to_table::<Lobby>("lobby", &self.lobby)
|
||||||
diff.wall = cache.apply_diff_to_table::<DbWall>("wall", &self.wall).with_updates_by_pk(|row| &row.lobby_id);
|
.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
|
diff
|
||||||
}
|
}
|
||||||
|
|
@ -228,25 +298,35 @@ pub struct AppliedDiff<'r> {
|
||||||
__unused: std::marker::PhantomData<&'r ()>,
|
__unused: std::marker::PhantomData<&'r ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for AppliedDiff<'_> {
|
impl __sdk::InModule for AppliedDiff<'_> {
|
||||||
type Module = RemoteModule;
|
type Module = RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
||||||
fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks<RemoteModule>) {
|
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::<Bot>("bot", &self.bot, event);
|
||||||
callbacks.invoke_table_row_callbacks::<GameTimer>("game_timer", &self.game_timer, event);
|
callbacks.invoke_table_row_callbacks::<GameTimer>("game_timer", &self.game_timer, event);
|
||||||
callbacks.invoke_table_row_callbacks::<Lobby>("lobby", &self.lobby, event);
|
callbacks.invoke_table_row_callbacks::<Lobby>("lobby", &self.lobby, event);
|
||||||
callbacks.invoke_table_row_callbacks::<Player>("logged_out_player", &self.logged_out_player, event);
|
callbacks.invoke_table_row_callbacks::<Player>(
|
||||||
|
"logged_out_player",
|
||||||
|
&self.logged_out_player,
|
||||||
|
event,
|
||||||
|
);
|
||||||
callbacks.invoke_table_row_callbacks::<Player>("player", &self.player, event);
|
callbacks.invoke_table_row_callbacks::<Player>("player", &self.player, event);
|
||||||
callbacks.invoke_table_row_callbacks::<PlayerClock>("player_clock", &self.player_clock, event);
|
callbacks.invoke_table_row_callbacks::<PlayerClock>(
|
||||||
|
"player_clock",
|
||||||
|
&self.player_clock,
|
||||||
|
event,
|
||||||
|
);
|
||||||
callbacks.invoke_table_row_callbacks::<PlayerHand>("player_hand", &self.player_hand, event);
|
callbacks.invoke_table_row_callbacks::<PlayerHand>("player_hand", &self.player_hand, event);
|
||||||
callbacks.invoke_table_row_callbacks::<DbTile>("tile", &self.tile, event);
|
callbacks.invoke_table_row_callbacks::<DbTile>("tile", &self.tile, event);
|
||||||
callbacks.invoke_table_row_callbacks::<DbWall>("wall", &self.wall, event);
|
callbacks.invoke_table_row_callbacks::<DbWall>("wall", &self.wall, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct RemoteModule;
|
pub struct RemoteModule;
|
||||||
|
|
@ -499,7 +579,6 @@ impl __sdk::SubscriptionHandle for SubscriptionHandle {
|
||||||
fn unsubscribe(self) -> __sdk::Result<()> {
|
fn unsubscribe(self) -> __sdk::Result<()> {
|
||||||
self.imp.unsubscribe_then(None)
|
self.imp.unsubscribe_then(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Alias trait for a [`__sdk::DbContext`] connected to this module,
|
/// Alias trait for a [`__sdk::DbContext`] connected to this module,
|
||||||
|
|
@ -507,19 +586,25 @@ impl __sdk::SubscriptionHandle for SubscriptionHandle {
|
||||||
///
|
///
|
||||||
/// Users can use this trait as a boundary on definitions which should accept
|
/// Users can use this trait as a boundary on definitions which should accept
|
||||||
/// either a [`DbConnection`] or an [`EventContext`] and operate on either.
|
/// either a [`DbConnection`] or an [`EventContext`] and operate on either.
|
||||||
pub trait RemoteDbContext: __sdk::DbContext<
|
pub trait RemoteDbContext:
|
||||||
|
__sdk::DbContext<
|
||||||
DbView = RemoteTables,
|
DbView = RemoteTables,
|
||||||
Reducers = RemoteReducers,
|
Reducers = RemoteReducers,
|
||||||
SetReducerFlags = SetReducerFlags,
|
SetReducerFlags = SetReducerFlags,
|
||||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||||
> {}
|
>
|
||||||
impl<Ctx: __sdk::DbContext<
|
{
|
||||||
|
}
|
||||||
|
impl<
|
||||||
|
Ctx: __sdk::DbContext<
|
||||||
DbView = RemoteTables,
|
DbView = RemoteTables,
|
||||||
Reducers = RemoteReducers,
|
Reducers = RemoteReducers,
|
||||||
SetReducerFlags = SetReducerFlags,
|
SetReducerFlags = SetReducerFlags,
|
||||||
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
|
||||||
>> RemoteDbContext for Ctx {}
|
>,
|
||||||
|
> RemoteDbContext for Ctx
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`],
|
/// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`],
|
||||||
/// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks.
|
/// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks.
|
||||||
|
|
@ -944,7 +1029,6 @@ impl __sdk::DbContext for ErrorContext {
|
||||||
impl __sdk::ErrorContext for ErrorContext {}
|
impl __sdk::ErrorContext for ErrorContext {}
|
||||||
|
|
||||||
impl __sdk::SpacetimeModule for RemoteModule {
|
impl __sdk::SpacetimeModule for RemoteModule {
|
||||||
|
|
||||||
type DbConnection = DbConnection;
|
type DbConnection = DbConnection;
|
||||||
type EventContext = EventContext;
|
type EventContext = EventContext;
|
||||||
type ReducerEventContext = ReducerEventContext;
|
type ReducerEventContext = ReducerEventContext;
|
||||||
|
|
@ -959,7 +1043,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
||||||
type AppliedDiff<'r> = AppliedDiff<'r>;
|
type AppliedDiff<'r> = AppliedDiff<'r>;
|
||||||
type SubscriptionHandle = SubscriptionHandle;
|
type SubscriptionHandle = SubscriptionHandle;
|
||||||
|
|
||||||
fn register_tables(client_cache: &mut __sdk::ClientCache<Self>) {
|
fn register_tables(client_cache: &mut __sdk::ClientCache<Self>) {
|
||||||
bot_table::register_table(client_cache);
|
bot_table::register_table(client_cache);
|
||||||
game_timer_table::register_table(client_cache);
|
game_timer_table::register_table(client_cache);
|
||||||
lobby_table::register_table(client_cache);
|
lobby_table::register_table(client_cache);
|
||||||
|
|
@ -969,5 +1053,5 @@ fn register_tables(client_cache: &mut __sdk::ClientCache<Self>) {
|
||||||
player_hand_table::register_table(client_cache);
|
player_hand_table::register_table(client_cache);
|
||||||
tile_table::register_table(client_cache);
|
tile_table::register_table(client_cache);
|
||||||
wall_table::register_table(client_cache);
|
wall_table::register_table(client_cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::player_clock_type::PlayerClock;
|
use super::player_clock_type::PlayerClock;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `player_clock`.
|
/// Table handle for the table `player_clock`.
|
||||||
///
|
///
|
||||||
|
|
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for PlayerClockTableHandle<'ctx> {
|
||||||
type Row = PlayerClock;
|
type Row = PlayerClock;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = PlayerClock> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = PlayerClock> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = PlayerClockInsertCallbackId;
|
type InsertCallbackId = PlayerClockInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -81,7 +80,6 @@ impl<'ctx> __sdk::Table for PlayerClockTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<PlayerClock>("player_clock");
|
let _table = client_cache.get_or_make_table::<PlayerClock>("player_clock");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerClockTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<PlayerClock>> {
|
) -> __sdk::Result<__sdk::TableUpdate<PlayerClock>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<PlayerClock>", "TableUpdate")
|
||||||
"TableUpdate<PlayerClock>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `player_clock`,
|
/// Access to the `id` unique index on the table `player_clock`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerClockIdUnique::find`] method.
|
/// via the [`PlayerClockIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player_clock().id().find(...)`.
|
/// like `ctx.db.player_clock().id().find(...)`.
|
||||||
pub struct PlayerClockIdUnique<'ctx> {
|
pub struct PlayerClockIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<PlayerClock, u32>,
|
imp: __sdk::UniqueConstraintHandle<PlayerClock, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerClockTableHandle<'ctx> {
|
impl<'ctx> PlayerClockTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `player_clock`.
|
/// Get a handle on the `id` unique index on the table `player_clock`.
|
||||||
pub fn id(&self) -> PlayerClockIdUnique<'ctx> {
|
pub fn id(&self) -> PlayerClockIdUnique<'ctx> {
|
||||||
PlayerClockIdUnique {
|
PlayerClockIdUnique {
|
||||||
|
|
@ -136,29 +132,29 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerClockIdUnique<'ctx> {
|
impl<'ctx> PlayerClockIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<PlayerClock> {
|
pub fn find(&self, col_val: &u32) -> Option<PlayerClock> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `player_id` unique index on the table `player_clock`,
|
/// Access to the `player_id` unique index on the table `player_clock`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerClockPlayerIdUnique::find`] method.
|
/// via the [`PlayerClockPlayerIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player_clock().player_id().find(...)`.
|
/// like `ctx.db.player_clock().player_id().find(...)`.
|
||||||
pub struct PlayerClockPlayerIdUnique<'ctx> {
|
pub struct PlayerClockPlayerIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<PlayerClock, u32>,
|
imp: __sdk::UniqueConstraintHandle<PlayerClock, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerClockTableHandle<'ctx> {
|
impl<'ctx> PlayerClockTableHandle<'ctx> {
|
||||||
/// Get a handle on the `player_id` unique index on the table `player_clock`.
|
/// Get a handle on the `player_id` unique index on the table `player_clock`.
|
||||||
pub fn player_id(&self) -> PlayerClockPlayerIdUnique<'ctx> {
|
pub fn player_id(&self) -> PlayerClockPlayerIdUnique<'ctx> {
|
||||||
PlayerClockPlayerIdUnique {
|
PlayerClockPlayerIdUnique {
|
||||||
|
|
@ -166,13 +162,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerClockPlayerIdUnique<'ctx> {
|
impl<'ctx> PlayerClockPlayerIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `player_id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `player_id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<PlayerClock> {
|
pub fn find(&self, col_val: &u32) -> Option<PlayerClock> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -19,8 +13,6 @@ pub struct PlayerClock {
|
||||||
pub total: u16,
|
pub total: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for PlayerClock {
|
impl __sdk::InModule for PlayerClock {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use super::db_tile_type::DbTile;
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::player_hand_type::PlayerHand;
|
use super::player_hand_type::PlayerHand;
|
||||||
use super::turn_state_type::TurnState;
|
use super::turn_state_type::TurnState;
|
||||||
use super::db_tile_type::DbTile;
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `player_hand`.
|
/// Table handle for the table `player_hand`.
|
||||||
///
|
///
|
||||||
|
|
@ -51,8 +46,12 @@ impl<'ctx> __sdk::Table for PlayerHandTableHandle<'ctx> {
|
||||||
type Row = PlayerHand;
|
type Row = PlayerHand;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = PlayerHand> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = PlayerHand> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = PlayerHandInsertCallbackId;
|
type InsertCallbackId = PlayerHandInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -83,7 +82,6 @@ impl<'ctx> __sdk::Table for PlayerHandTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<PlayerHand>("player_hand");
|
let _table = client_cache.get_or_make_table::<PlayerHand>("player_hand");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
_table.add_unique_constraint::<u32>("player_id", |row| &row.player_id);
|
||||||
|
|
@ -105,32 +103,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerHandTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<PlayerHand>> {
|
) -> __sdk::Result<__sdk::TableUpdate<PlayerHand>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<PlayerHand>", "TableUpdate")
|
||||||
"TableUpdate<PlayerHand>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `player_hand`,
|
/// Access to the `id` unique index on the table `player_hand`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerHandIdUnique::find`] method.
|
/// via the [`PlayerHandIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player_hand().id().find(...)`.
|
/// like `ctx.db.player_hand().id().find(...)`.
|
||||||
pub struct PlayerHandIdUnique<'ctx> {
|
pub struct PlayerHandIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `player_hand`.
|
/// Get a handle on the `id` unique index on the table `player_hand`.
|
||||||
pub fn id(&self) -> PlayerHandIdUnique<'ctx> {
|
pub fn id(&self) -> PlayerHandIdUnique<'ctx> {
|
||||||
PlayerHandIdUnique {
|
PlayerHandIdUnique {
|
||||||
|
|
@ -138,29 +134,29 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerHandIdUnique<'ctx> {
|
impl<'ctx> PlayerHandIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<PlayerHand> {
|
pub fn find(&self, col_val: &u32) -> Option<PlayerHand> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `player_id` unique index on the table `player_hand`,
|
/// Access to the `player_id` unique index on the table `player_hand`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerHandPlayerIdUnique::find`] method.
|
/// via the [`PlayerHandPlayerIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player_hand().player_id().find(...)`.
|
/// like `ctx.db.player_hand().player_id().find(...)`.
|
||||||
pub struct PlayerHandPlayerIdUnique<'ctx> {
|
pub struct PlayerHandPlayerIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
imp: __sdk::UniqueConstraintHandle<PlayerHand, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
impl<'ctx> PlayerHandTableHandle<'ctx> {
|
||||||
/// Get a handle on the `player_id` unique index on the table `player_hand`.
|
/// Get a handle on the `player_id` unique index on the table `player_hand`.
|
||||||
pub fn player_id(&self) -> PlayerHandPlayerIdUnique<'ctx> {
|
pub fn player_id(&self) -> PlayerHandPlayerIdUnique<'ctx> {
|
||||||
PlayerHandPlayerIdUnique {
|
PlayerHandPlayerIdUnique {
|
||||||
|
|
@ -168,13 +164,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerHandPlayerIdUnique<'ctx> {
|
impl<'ctx> PlayerHandPlayerIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `player_id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `player_id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<PlayerHand> {
|
pub fn find(&self, col_val: &u32) -> Option<PlayerHand> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::turn_state_type::TurnState;
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
|
use super::turn_state_type::TurnState;
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -18,13 +13,11 @@ pub struct PlayerHand {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
pub player_id: u32,
|
pub player_id: u32,
|
||||||
pub turn_state: TurnState,
|
pub turn_state: TurnState,
|
||||||
pub pond: Vec::<DbTile>,
|
pub pond: Vec<DbTile>,
|
||||||
pub hand: Vec::<DbTile>,
|
pub hand: Vec<DbTile>,
|
||||||
pub working_tile: Option::<DbTile>,
|
pub working_tile: Option<DbTile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for PlayerHand {
|
impl __sdk::InModule for PlayerHand {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -16,12 +10,8 @@ pub enum PlayerOrBot {
|
||||||
Player(u32),
|
Player(u32),
|
||||||
|
|
||||||
Bot(u32),
|
Bot(u32),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for PlayerOrBot {
|
impl __sdk::InModule for PlayerOrBot {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::player_type::Player;
|
use super::player_type::Player;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `player`.
|
/// Table handle for the table `player`.
|
||||||
///
|
///
|
||||||
|
|
@ -49,8 +44,12 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> {
|
||||||
type Row = Player;
|
type Row = Player;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = Player> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = Player> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = PlayerInsertCallbackId;
|
type InsertCallbackId = PlayerInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -81,7 +80,6 @@ impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<Player>("player");
|
let _table = client_cache.get_or_make_table::<Player>("player");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
_table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity);
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
) -> __sdk::Result<__sdk::TableUpdate<Player>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<Player>", "TableUpdate")
|
||||||
"TableUpdate<Player>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `player`,
|
/// Access to the `id` unique index on the table `player`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerIdUnique::find`] method.
|
/// via the [`PlayerIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player().id().find(...)`.
|
/// like `ctx.db.player().id().find(...)`.
|
||||||
pub struct PlayerIdUnique<'ctx> {
|
pub struct PlayerIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
imp: __sdk::UniqueConstraintHandle<Player, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `player`.
|
/// Get a handle on the `id` unique index on the table `player`.
|
||||||
pub fn id(&self) -> PlayerIdUnique<'ctx> {
|
pub fn id(&self) -> PlayerIdUnique<'ctx> {
|
||||||
PlayerIdUnique {
|
PlayerIdUnique {
|
||||||
|
|
@ -136,43 +132,44 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerIdUnique<'ctx> {
|
impl<'ctx> PlayerIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<Player> {
|
pub fn find(&self, col_val: &u32) -> Option<Player> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `identity` unique index on the table `player`,
|
/// Access to the `identity` unique index on the table `player`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`PlayerIdentityUnique::find`] method.
|
/// via the [`PlayerIdentityUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.player().identity().find(...)`.
|
/// like `ctx.db.player().identity().find(...)`.
|
||||||
pub struct PlayerIdentityUnique<'ctx> {
|
pub struct PlayerIdentityUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
imp: __sdk::UniqueConstraintHandle<Player, __sdk::Identity>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerTableHandle<'ctx> {
|
impl<'ctx> PlayerTableHandle<'ctx> {
|
||||||
/// Get a handle on the `identity` unique index on the table `player`.
|
/// Get a handle on the `identity` unique index on the table `player`.
|
||||||
pub fn identity(&self) -> PlayerIdentityUnique<'ctx> {
|
pub fn identity(&self) -> PlayerIdentityUnique<'ctx> {
|
||||||
PlayerIdentityUnique {
|
PlayerIdentityUnique {
|
||||||
imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"),
|
imp: self
|
||||||
|
.imp
|
||||||
|
.get_unique_constraint::<__sdk::Identity>("identity"),
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> PlayerIdentityUnique<'ctx> {
|
impl<'ctx> PlayerIdentityUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
|
/// Find the subscribed row whose `identity` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
|
pub fn find(&self, col_val: &__sdk::Identity) -> Option<Player> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,19 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
pub identity: __sdk::Identity,
|
pub identity: __sdk::Identity,
|
||||||
pub name: Option::<String>,
|
pub name: Option<String>,
|
||||||
pub lobby_id: u32,
|
pub lobby_id: u32,
|
||||||
pub ready: bool,
|
pub ready: bool,
|
||||||
pub sort: bool,
|
pub sort: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Player {
|
impl __sdk::InModule for Player {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -16,8 +10,6 @@ pub struct Rank {
|
||||||
pub number: u8,
|
pub number: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Rank {
|
impl __sdk::InModule for Rank {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -18,10 +12,8 @@ pub(super) struct SetReadyArgs {
|
||||||
|
|
||||||
impl From<SetReadyArgs> for super::Reducer {
|
impl From<SetReadyArgs> for super::Reducer {
|
||||||
fn from(args: SetReadyArgs) -> Self {
|
fn from(args: SetReadyArgs) -> Self {
|
||||||
Self::SetReady {
|
Self::SetReady { ready: args.ready }
|
||||||
ready: args.ready,
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl __sdk::InModule for SetReadyArgs {
|
impl __sdk::InModule for SetReadyArgs {
|
||||||
|
|
@ -40,8 +32,7 @@ pub trait set_ready {
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
/// This method returns immediately, and errors only if we are unable to send the request.
|
||||||
/// The reducer will run asynchronously in the future,
|
/// The reducer will run asynchronously in the future,
|
||||||
/// and its status can be observed by listening for [`Self::on_set_ready`] callbacks.
|
/// and its status can be observed by listening for [`Self::on_set_ready`] callbacks.
|
||||||
fn set_ready(&self, ready: bool,
|
fn set_ready(&self, ready: bool) -> __sdk::Result<()>;
|
||||||
) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `set_ready`.
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `set_ready`.
|
||||||
///
|
///
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
||||||
|
|
@ -49,35 +40,39 @@ pub trait set_ready {
|
||||||
///
|
///
|
||||||
/// The returned [`SetReadyCallbackId`] can be passed to [`Self::remove_on_set_ready`]
|
/// The returned [`SetReadyCallbackId`] can be passed to [`Self::remove_on_set_ready`]
|
||||||
/// to cancel the callback.
|
/// to cancel the callback.
|
||||||
fn on_set_ready(&self, callback: impl FnMut(&super::ReducerEventContext, &bool, ) + Send + 'static) -> SetReadyCallbackId;
|
fn on_set_ready(
|
||||||
|
&self,
|
||||||
|
callback: impl FnMut(&super::ReducerEventContext, &bool) + Send + 'static,
|
||||||
|
) -> SetReadyCallbackId;
|
||||||
/// Cancel a callback previously registered by [`Self::on_set_ready`],
|
/// Cancel a callback previously registered by [`Self::on_set_ready`],
|
||||||
/// causing it not to run in the future.
|
/// causing it not to run in the future.
|
||||||
fn remove_on_set_ready(&self, callback: SetReadyCallbackId);
|
fn remove_on_set_ready(&self, callback: SetReadyCallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl set_ready for super::RemoteReducers {
|
impl set_ready for super::RemoteReducers {
|
||||||
fn set_ready(&self, ready: bool,
|
fn set_ready(&self, ready: bool) -> __sdk::Result<()> {
|
||||||
) -> __sdk::Result<()> {
|
self.imp.call_reducer("set_ready", SetReadyArgs { ready })
|
||||||
self.imp.call_reducer("set_ready", SetReadyArgs { ready, })
|
|
||||||
}
|
}
|
||||||
fn on_set_ready(
|
fn on_set_ready(
|
||||||
&self,
|
&self,
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &bool, ) + Send + 'static,
|
mut callback: impl FnMut(&super::ReducerEventContext, &bool) + Send + 'static,
|
||||||
) -> SetReadyCallbackId {
|
) -> SetReadyCallbackId {
|
||||||
SetReadyCallbackId(self.imp.on_reducer(
|
SetReadyCallbackId(self.imp.on_reducer(
|
||||||
"set_ready",
|
"set_ready",
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
||||||
#[allow(irrefutable_let_patterns)]
|
#[allow(irrefutable_let_patterns)]
|
||||||
let super::ReducerEventContext {
|
let super::ReducerEventContext {
|
||||||
event: __sdk::ReducerEvent {
|
event:
|
||||||
reducer: super::Reducer::SetReady {
|
__sdk::ReducerEvent {
|
||||||
ready,
|
reducer: super::Reducer::SetReady { ready },
|
||||||
},
|
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} = ctx else { unreachable!() };
|
} = ctx
|
||||||
callback(ctx, ready, )
|
else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
callback(ctx, ready)
|
||||||
}),
|
}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -105,4 +100,3 @@ impl set_flags_for_set_ready for super::SetReducerFlags {
|
||||||
self.imp.set_call_reducer_flags("set_ready", flags);
|
self.imp.set_call_reducer_flags("set_ready", flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub(super) struct ShuffleDealArgs {
|
|
||||||
pub lobby_id: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ShuffleDealArgs> for super::Reducer {
|
|
||||||
fn from(args: ShuffleDealArgs) -> Self {
|
|
||||||
Self::ShuffleDeal {
|
|
||||||
lobby_id: args.lobby_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for ShuffleDealArgs {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ShuffleDealCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the reducer `shuffle_deal`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteReducers`].
|
|
||||||
pub trait shuffle_deal {
|
|
||||||
/// Request that the remote module invoke the reducer `shuffle_deal` to run as soon as possible.
|
|
||||||
///
|
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
|
||||||
/// The reducer will run asynchronously in the future,
|
|
||||||
/// and its status can be observed by listening for [`Self::on_shuffle_deal`] callbacks.
|
|
||||||
fn shuffle_deal(&self, lobby_id: u32) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `shuffle_deal`.
|
|
||||||
///
|
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
||||||
/// to determine the reducer's status.
|
|
||||||
///
|
|
||||||
/// The returned [`ShuffleDealCallbackId`] can be passed to [`Self::remove_on_shuffle_deal`]
|
|
||||||
/// to cancel the callback.
|
|
||||||
fn on_shuffle_deal(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
|
||||||
) -> ShuffleDealCallbackId;
|
|
||||||
/// Cancel a callback previously registered by [`Self::on_shuffle_deal`],
|
|
||||||
/// causing it not to run in the future.
|
|
||||||
fn remove_on_shuffle_deal(&self, callback: ShuffleDealCallbackId);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl shuffle_deal for super::RemoteReducers {
|
|
||||||
fn shuffle_deal(&self, lobby_id: u32) -> __sdk::Result<()> {
|
|
||||||
self.imp
|
|
||||||
.call_reducer("shuffle_deal", ShuffleDealArgs { lobby_id })
|
|
||||||
}
|
|
||||||
fn on_shuffle_deal(
|
|
||||||
&self,
|
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
|
||||||
) -> ShuffleDealCallbackId {
|
|
||||||
ShuffleDealCallbackId(self.imp.on_reducer(
|
|
||||||
"shuffle_deal",
|
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
||||||
#[allow(irrefutable_let_patterns)]
|
|
||||||
let super::ReducerEventContext {
|
|
||||||
event:
|
|
||||||
__sdk::ReducerEvent {
|
|
||||||
reducer: super::Reducer::ShuffleDeal { lobby_id },
|
|
||||||
..
|
|
||||||
},
|
|
||||||
..
|
|
||||||
} = ctx
|
|
||||||
else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
callback(ctx, lobby_id)
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn remove_on_shuffle_deal(&self, callback: ShuffleDealCallbackId) {
|
|
||||||
self.imp.remove_on_reducer("shuffle_deal", callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Extension trait for setting the call-flags for the reducer `shuffle_deal`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::SetReducerFlags`].
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
pub trait set_flags_for_shuffle_deal {
|
|
||||||
/// Set the call-reducer flags for the reducer `shuffle_deal` to `flags`.
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
fn shuffle_deal(&self, flags: __ws::CallReducerFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl set_flags_for_shuffle_deal for super::SetReducerFlags {
|
|
||||||
fn shuffle_deal(&self, flags: __ws::CallReducerFlags) {
|
|
||||||
self.imp.set_call_reducer_flags("shuffle_deal", flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub(super) struct SkipCallArgs {}
|
|
||||||
|
|
||||||
impl From<SkipCallArgs> for super::Reducer {
|
|
||||||
fn from(args: SkipCallArgs) -> Self {
|
|
||||||
Self::SkipCall
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for SkipCallArgs {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct SkipCallCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the reducer `skip_call`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteReducers`].
|
|
||||||
pub trait skip_call {
|
|
||||||
/// Request that the remote module invoke the reducer `skip_call` to run as soon as possible.
|
|
||||||
///
|
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
|
||||||
/// The reducer will run asynchronously in the future,
|
|
||||||
/// and its status can be observed by listening for [`Self::on_skip_call`] callbacks.
|
|
||||||
fn skip_call(&self) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `skip_call`.
|
|
||||||
///
|
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
||||||
/// to determine the reducer's status.
|
|
||||||
///
|
|
||||||
/// The returned [`SkipCallCallbackId`] can be passed to [`Self::remove_on_skip_call`]
|
|
||||||
/// to cancel the callback.
|
|
||||||
fn on_skip_call(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> SkipCallCallbackId;
|
|
||||||
/// Cancel a callback previously registered by [`Self::on_skip_call`],
|
|
||||||
/// causing it not to run in the future.
|
|
||||||
fn remove_on_skip_call(&self, callback: SkipCallCallbackId);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl skip_call for super::RemoteReducers {
|
|
||||||
fn skip_call(&self) -> __sdk::Result<()> {
|
|
||||||
self.imp.call_reducer("skip_call", SkipCallArgs {})
|
|
||||||
}
|
|
||||||
fn on_skip_call(
|
|
||||||
&self,
|
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> SkipCallCallbackId {
|
|
||||||
SkipCallCallbackId(self.imp.on_reducer(
|
|
||||||
"skip_call",
|
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
||||||
#[allow(irrefutable_let_patterns)]
|
|
||||||
let super::ReducerEventContext {
|
|
||||||
event:
|
|
||||||
__sdk::ReducerEvent {
|
|
||||||
reducer: super::Reducer::SkipCall {},
|
|
||||||
..
|
|
||||||
},
|
|
||||||
..
|
|
||||||
} = ctx
|
|
||||||
else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
callback(ctx)
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn remove_on_skip_call(&self, callback: SkipCallCallbackId) {
|
|
||||||
self.imp.remove_on_reducer("skip_call", callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Extension trait for setting the call-flags for the reducer `skip_call`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::SetReducerFlags`].
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
pub trait set_flags_for_skip_call {
|
|
||||||
/// Set the call-reducer flags for the reducer `skip_call` to `flags`.
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
fn skip_call(&self, flags: __ws::CallReducerFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl set_flags_for_skip_call for super::SetReducerFlags {
|
|
||||||
fn skip_call(&self, flags: __ws::CallReducerFlags) {
|
|
||||||
self.imp.set_call_reducer_flags("skip_call", flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
// 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 spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
||||||
#[sats(crate = __lib)]
|
|
||||||
pub(super) struct StartGameArgs {}
|
|
||||||
|
|
||||||
impl From<StartGameArgs> for super::Reducer {
|
|
||||||
fn from(args: StartGameArgs) -> Self {
|
|
||||||
Self::StartGame
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl __sdk::InModule for StartGameArgs {
|
|
||||||
type Module = super::RemoteModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct StartGameCallbackId(__sdk::CallbackId);
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
/// Extension trait for access to the reducer `start_game`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::RemoteReducers`].
|
|
||||||
pub trait start_game {
|
|
||||||
/// Request that the remote module invoke the reducer `start_game` to run as soon as possible.
|
|
||||||
///
|
|
||||||
/// This method returns immediately, and errors only if we are unable to send the request.
|
|
||||||
/// The reducer will run asynchronously in the future,
|
|
||||||
/// and its status can be observed by listening for [`Self::on_start_game`] callbacks.
|
|
||||||
fn start_game(&self) -> __sdk::Result<()>;
|
|
||||||
/// Register a callback to run whenever we are notified of an invocation of the reducer `start_game`.
|
|
||||||
///
|
|
||||||
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
||||||
/// to determine the reducer's status.
|
|
||||||
///
|
|
||||||
/// The returned [`StartGameCallbackId`] can be passed to [`Self::remove_on_start_game`]
|
|
||||||
/// to cancel the callback.
|
|
||||||
fn on_start_game(
|
|
||||||
&self,
|
|
||||||
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> StartGameCallbackId;
|
|
||||||
/// Cancel a callback previously registered by [`Self::on_start_game`],
|
|
||||||
/// causing it not to run in the future.
|
|
||||||
fn remove_on_start_game(&self, callback: StartGameCallbackId);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl start_game for super::RemoteReducers {
|
|
||||||
fn start_game(&self) -> __sdk::Result<()> {
|
|
||||||
self.imp.call_reducer("start_game", StartGameArgs {})
|
|
||||||
}
|
|
||||||
fn on_start_game(
|
|
||||||
&self,
|
|
||||||
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
||||||
) -> StartGameCallbackId {
|
|
||||||
StartGameCallbackId(self.imp.on_reducer(
|
|
||||||
"start_game",
|
|
||||||
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
||||||
#[allow(irrefutable_let_patterns)]
|
|
||||||
let super::ReducerEventContext {
|
|
||||||
event:
|
|
||||||
__sdk::ReducerEvent {
|
|
||||||
reducer: super::Reducer::StartGame {},
|
|
||||||
..
|
|
||||||
},
|
|
||||||
..
|
|
||||||
} = ctx
|
|
||||||
else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
callback(ctx)
|
|
||||||
}),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
fn remove_on_start_game(&self, callback: StartGameCallbackId) {
|
|
||||||
self.imp.remove_on_reducer("start_game", callback.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Extension trait for setting the call-flags for the reducer `start_game`.
|
|
||||||
///
|
|
||||||
/// Implemented for [`super::SetReducerFlags`].
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
pub trait set_flags_for_start_game {
|
|
||||||
/// Set the call-reducer flags for the reducer `start_game` to `flags`.
|
|
||||||
///
|
|
||||||
/// This type is currently unstable and may be removed without a major version bump.
|
|
||||||
fn start_game(&self, flags: __ws::CallReducerFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl set_flags_for_start_game for super::SetReducerFlags {
|
|
||||||
fn start_game(&self, flags: __ws::CallReducerFlags) {
|
|
||||||
self.imp.set_call_reducer_flags("start_game", flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,16 +2,11 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
use super::dragon_type::Dragon;
|
||||||
use super::rank_type::Rank;
|
use super::rank_type::Rank;
|
||||||
use super::wind_type::Wind;
|
use super::wind_type::Wind;
|
||||||
use super::dragon_type::Dragon;
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -25,12 +20,8 @@ pub enum Suit {
|
||||||
Wind(Wind),
|
Wind(Wind),
|
||||||
|
|
||||||
Dragon(Dragon),
|
Dragon(Dragon),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Suit {
|
impl __sdk::InModule for Suit {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,9 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
use super::tile_type::Tile;
|
use super::tile_type::Tile;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `tile`.
|
/// Table handle for the table `tile`.
|
||||||
///
|
///
|
||||||
|
|
@ -50,8 +45,12 @@ impl<'ctx> __sdk::Table for TileTableHandle<'ctx> {
|
||||||
type Row = DbTile;
|
type Row = DbTile;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = DbTile> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = DbTile> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = TileInsertCallbackId;
|
type InsertCallbackId = TileInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -82,7 +81,6 @@ impl<'ctx> __sdk::Table for TileTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<DbTile>("tile");
|
let _table = client_cache.get_or_make_table::<DbTile>("tile");
|
||||||
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
_table.add_unique_constraint::<u32>("id", |row| &row.id);
|
||||||
}
|
}
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for TileTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<DbTile>> {
|
) -> __sdk::Result<__sdk::TableUpdate<DbTile>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<DbTile>", "TableUpdate")
|
||||||
"TableUpdate<DbTile>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `id` unique index on the table `tile`,
|
/// Access to the `id` unique index on the table `tile`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`TileIdUnique::find`] method.
|
/// via the [`TileIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.tile().id().find(...)`.
|
/// like `ctx.db.tile().id().find(...)`.
|
||||||
pub struct TileIdUnique<'ctx> {
|
pub struct TileIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<DbTile, u32>,
|
imp: __sdk::UniqueConstraintHandle<DbTile, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> TileTableHandle<'ctx> {
|
impl<'ctx> TileTableHandle<'ctx> {
|
||||||
/// Get a handle on the `id` unique index on the table `tile`.
|
/// Get a handle on the `id` unique index on the table `tile`.
|
||||||
pub fn id(&self) -> TileIdUnique<'ctx> {
|
pub fn id(&self) -> TileIdUnique<'ctx> {
|
||||||
TileIdUnique {
|
TileIdUnique {
|
||||||
|
|
@ -136,13 +132,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> TileIdUnique<'ctx> {
|
impl<'ctx> TileIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<DbTile> {
|
pub fn find(&self, col_val: &u32) -> Option<DbTile> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::suit_type::Suit;
|
use super::suit_type::Suit;
|
||||||
|
|
||||||
|
|
@ -17,8 +12,6 @@ pub struct Tile {
|
||||||
pub suit: Suit,
|
pub suit: Suit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Tile {
|
impl __sdk::InModule for Tile {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -24,12 +19,8 @@ pub enum TurnState {
|
||||||
RonChiiPonKan,
|
RonChiiPonKan,
|
||||||
|
|
||||||
End,
|
End,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for TurnState {
|
impl __sdk::InModule for TurnState {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,9 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
use super::db_wall_type::DbWall;
|
|
||||||
use super::db_tile_type::DbTile;
|
use super::db_tile_type::DbTile;
|
||||||
|
use super::db_wall_type::DbWall;
|
||||||
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
|
|
||||||
/// Table handle for the table `wall`.
|
/// Table handle for the table `wall`.
|
||||||
///
|
///
|
||||||
|
|
@ -50,8 +45,12 @@ impl<'ctx> __sdk::Table for WallTableHandle<'ctx> {
|
||||||
type Row = DbWall;
|
type Row = DbWall;
|
||||||
type EventContext = super::EventContext;
|
type EventContext = super::EventContext;
|
||||||
|
|
||||||
fn count(&self) -> u64 { self.imp.count() }
|
fn count(&self) -> u64 {
|
||||||
fn iter(&self) -> impl Iterator<Item = DbWall> + '_ { self.imp.iter() }
|
self.imp.count()
|
||||||
|
}
|
||||||
|
fn iter(&self) -> impl Iterator<Item = DbWall> + '_ {
|
||||||
|
self.imp.iter()
|
||||||
|
}
|
||||||
|
|
||||||
type InsertCallbackId = WallInsertCallbackId;
|
type InsertCallbackId = WallInsertCallbackId;
|
||||||
|
|
||||||
|
|
@ -82,7 +81,6 @@ impl<'ctx> __sdk::Table for WallTableHandle<'ctx> {
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||||
|
|
||||||
let _table = client_cache.get_or_make_table::<DbWall>("wall");
|
let _table = client_cache.get_or_make_table::<DbWall>("wall");
|
||||||
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
_table.add_unique_constraint::<u32>("lobby_id", |row| &row.lobby_id);
|
||||||
}
|
}
|
||||||
|
|
@ -103,32 +101,30 @@ impl<'ctx> __sdk::TableWithPrimaryKey for WallTableHandle<'ctx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(super) fn parse_table_update(
|
pub(super) fn parse_table_update(
|
||||||
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
raw_updates: __ws::TableUpdate<__ws::BsatnFormat>,
|
||||||
) -> __sdk::Result<__sdk::TableUpdate<DbWall>> {
|
) -> __sdk::Result<__sdk::TableUpdate<DbWall>> {
|
||||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||||
__sdk::InternalError::failed_parse(
|
__sdk::InternalError::failed_parse("TableUpdate<DbWall>", "TableUpdate")
|
||||||
"TableUpdate<DbWall>",
|
.with_cause(e)
|
||||||
"TableUpdate",
|
.into()
|
||||||
).with_cause(e).into()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access to the `lobby_id` unique index on the table `wall`,
|
/// Access to the `lobby_id` unique index on the table `wall`,
|
||||||
/// which allows point queries on the field of the same name
|
/// which allows point queries on the field of the same name
|
||||||
/// via the [`WallLobbyIdUnique::find`] method.
|
/// via the [`WallLobbyIdUnique::find`] method.
|
||||||
///
|
///
|
||||||
/// Users are encouraged not to explicitly reference this type,
|
/// Users are encouraged not to explicitly reference this type,
|
||||||
/// but to directly chain method calls,
|
/// but to directly chain method calls,
|
||||||
/// like `ctx.db.wall().lobby_id().find(...)`.
|
/// like `ctx.db.wall().lobby_id().find(...)`.
|
||||||
pub struct WallLobbyIdUnique<'ctx> {
|
pub struct WallLobbyIdUnique<'ctx> {
|
||||||
imp: __sdk::UniqueConstraintHandle<DbWall, u32>,
|
imp: __sdk::UniqueConstraintHandle<DbWall, u32>,
|
||||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> WallTableHandle<'ctx> {
|
impl<'ctx> WallTableHandle<'ctx> {
|
||||||
/// Get a handle on the `lobby_id` unique index on the table `wall`.
|
/// Get a handle on the `lobby_id` unique index on the table `wall`.
|
||||||
pub fn lobby_id(&self) -> WallLobbyIdUnique<'ctx> {
|
pub fn lobby_id(&self) -> WallLobbyIdUnique<'ctx> {
|
||||||
WallLobbyIdUnique {
|
WallLobbyIdUnique {
|
||||||
|
|
@ -136,13 +132,12 @@ pub(super) fn parse_table_update(
|
||||||
phantom: std::marker::PhantomData,
|
phantom: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> WallLobbyIdUnique<'ctx> {
|
impl<'ctx> WallLobbyIdUnique<'ctx> {
|
||||||
/// Find the subscribed row whose `lobby_id` column value is equal to `col_val`,
|
/// Find the subscribed row whose `lobby_id` column value is equal to `col_val`,
|
||||||
/// if such a row is present in the client cache.
|
/// if such a row is present in the client cache.
|
||||||
pub fn find(&self, col_val: &u32) -> Option<DbWall> {
|
pub fn find(&self, col_val: &u32) -> Option<DbWall> {
|
||||||
self.imp.find(col_val)
|
self.imp.find(col_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,7 @@
|
||||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||||
|
|
||||||
#![allow(unused, clippy::all)]
|
#![allow(unused, clippy::all)]
|
||||||
use spacetimedb_sdk::__codegen::{
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||||
self as __sdk,
|
|
||||||
__lib,
|
|
||||||
__sats,
|
|
||||||
__ws,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||||
#[sats(crate = __lib)]
|
#[sats(crate = __lib)]
|
||||||
|
|
@ -20,12 +15,8 @@ pub enum Wind {
|
||||||
Shaa,
|
Shaa,
|
||||||
|
|
||||||
Pei,
|
Pei,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl __sdk::InModule for Wind {
|
impl __sdk::InModule for Wind {
|
||||||
type Module = super::RemoteModule;
|
type Module = super::RemoteModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue