2026-02-20 15:36:04 -08:00
|
|
|
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
|
|
|
|
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
|
|
|
|
|
|
|
|
|
#![allow(unused, clippy::all)]
|
2026-02-22 00:08:02 -08:00
|
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
2026-02-20 15:36:04 -08:00
|
|
|
|
|
|
|
|
use super::game_timer_type::GameTimer;
|
|
|
|
|
|
|
|
|
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
|
|
|
#[sats(crate = __lib)]
|
|
|
|
|
pub(super) struct AdvanceGameArgs {
|
|
|
|
|
pub game_timer: GameTimer,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<AdvanceGameArgs> for super::Reducer {
|
|
|
|
|
fn from(args: AdvanceGameArgs) -> Self {
|
|
|
|
|
Self::AdvanceGame {
|
|
|
|
|
game_timer: args.game_timer,
|
2026-02-22 00:08:02 -08:00
|
|
|
}
|
|
|
|
|
}
|
2026-02-20 15:36:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl __sdk::InModule for AdvanceGameArgs {
|
|
|
|
|
type Module = super::RemoteModule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct AdvanceGameCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
/// Extension trait for access to the reducer `advance_game`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::RemoteReducers`].
|
|
|
|
|
pub trait advance_game {
|
|
|
|
|
/// Request that the remote module invoke the reducer `advance_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_advance_game`] callbacks.
|
2026-02-22 00:08:02 -08:00
|
|
|
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()>;
|
2026-02-20 15:36:04 -08:00
|
|
|
/// 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`]
|
|
|
|
|
/// to determine the reducer's status.
|
|
|
|
|
///
|
|
|
|
|
/// The returned [`AdvanceGameCallbackId`] can be passed to [`Self::remove_on_advance_game`]
|
|
|
|
|
/// to cancel the callback.
|
2026-02-22 00:08:02 -08:00
|
|
|
fn on_advance_game(
|
|
|
|
|
&self,
|
|
|
|
|
callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
|
|
|
|
) -> AdvanceGameCallbackId;
|
2026-02-20 15:36:04 -08:00
|
|
|
/// Cancel a callback previously registered by [`Self::on_advance_game`],
|
|
|
|
|
/// causing it not to run in the future.
|
|
|
|
|
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl advance_game for super::RemoteReducers {
|
2026-02-22 00:08:02 -08:00
|
|
|
fn advance_game(&self, game_timer: GameTimer) -> __sdk::Result<()> {
|
|
|
|
|
self.imp
|
|
|
|
|
.call_reducer("advance_game", AdvanceGameArgs { game_timer })
|
2026-02-20 15:36:04 -08:00
|
|
|
}
|
|
|
|
|
fn on_advance_game(
|
|
|
|
|
&self,
|
2026-02-22 00:08:02 -08:00
|
|
|
mut callback: impl FnMut(&super::ReducerEventContext, &GameTimer) + Send + 'static,
|
2026-02-20 15:36:04 -08:00
|
|
|
) -> AdvanceGameCallbackId {
|
|
|
|
|
AdvanceGameCallbackId(self.imp.on_reducer(
|
|
|
|
|
"advance_game",
|
|
|
|
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
|
|
|
#[allow(irrefutable_let_patterns)]
|
|
|
|
|
let super::ReducerEventContext {
|
2026-02-22 00:08:02 -08:00
|
|
|
event:
|
|
|
|
|
__sdk::ReducerEvent {
|
|
|
|
|
reducer: super::Reducer::AdvanceGame { game_timer },
|
|
|
|
|
..
|
2026-02-20 15:36:04 -08:00
|
|
|
},
|
|
|
|
|
..
|
2026-02-22 00:08:02 -08:00
|
|
|
} = ctx
|
|
|
|
|
else {
|
|
|
|
|
unreachable!()
|
|
|
|
|
};
|
|
|
|
|
callback(ctx, game_timer)
|
2026-02-20 15:36:04 -08:00
|
|
|
}),
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
fn remove_on_advance_game(&self, callback: AdvanceGameCallbackId) {
|
|
|
|
|
self.imp.remove_on_reducer("advance_game", callback.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
/// Extension trait for setting the call-flags for the reducer `advance_game`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::SetReducerFlags`].
|
|
|
|
|
///
|
|
|
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
|
|
|
pub trait set_flags_for_advance_game {
|
|
|
|
|
/// Set the call-reducer flags for the reducer `advance_game` to `flags`.
|
|
|
|
|
///
|
|
|
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
|
|
|
fn advance_game(&self, flags: __ws::CallReducerFlags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl set_flags_for_advance_game for super::SetReducerFlags {
|
|
|
|
|
fn advance_game(&self, flags: __ws::CallReducerFlags) {
|
|
|
|
|
self.imp.set_call_reducer_flags("advance_game", flags);
|
|
|
|
|
}
|
|
|
|
|
}
|