jong/module_bindings/shuffle_wall_reducer.rs

101 lines
3.7 KiB
Rust
Raw Normal View History

2026-02-06 23:51:08 -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)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
2026-02-07 17:46:03 -08:00
pub(super) struct ShuffleWallArgs {}
2026-02-06 23:51:08 -08:00
2026-02-07 17:46:03 -08:00
impl From<ShuffleWallArgs> for super::Reducer {
fn from(args: ShuffleWallArgs) -> Self {
Self::ShuffleWall
2026-02-06 23:51:08 -08:00
}
}
2026-02-07 17:46:03 -08:00
impl __sdk::InModule for ShuffleWallArgs {
2026-02-06 23:51:08 -08:00
type Module = super::RemoteModule;
}
2026-02-07 17:46:03 -08:00
pub struct ShuffleWallCallbackId(__sdk::CallbackId);
2026-02-06 23:51:08 -08:00
#[allow(non_camel_case_types)]
2026-02-07 17:46:03 -08:00
/// Extension trait for access to the reducer `shuffle_wall`.
2026-02-06 23:51:08 -08:00
///
/// Implemented for [`super::RemoteReducers`].
2026-02-07 17:46:03 -08:00
pub trait shuffle_wall {
/// Request that the remote module invoke the reducer `shuffle_wall` to run as soon as possible.
2026-02-06 23:51:08 -08:00
///
/// This method returns immediately, and errors only if we are unable to send the request.
/// The reducer will run asynchronously in the future,
2026-02-07 17:46:03 -08:00
/// and its status can be observed by listening for [`Self::on_shuffle_wall`] callbacks.
fn shuffle_wall(&self) -> __sdk::Result<()>;
/// Register a callback to run whenever we are notified of an invocation of the reducer `shuffle_wall`.
2026-02-06 23:51:08 -08:00
///
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
/// to determine the reducer's status.
///
2026-02-07 17:46:03 -08:00
/// The returned [`ShuffleWallCallbackId`] can be passed to [`Self::remove_on_shuffle_wall`]
2026-02-06 23:51:08 -08:00
/// to cancel the callback.
2026-02-07 17:46:03 -08:00
fn on_shuffle_wall(
2026-02-06 23:51:08 -08:00
&self,
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
2026-02-07 17:46:03 -08:00
) -> ShuffleWallCallbackId;
/// Cancel a callback previously registered by [`Self::on_shuffle_wall`],
2026-02-06 23:51:08 -08:00
/// causing it not to run in the future.
2026-02-07 17:46:03 -08:00
fn remove_on_shuffle_wall(&self, callback: ShuffleWallCallbackId);
2026-02-06 23:51:08 -08:00
}
2026-02-07 17:46:03 -08:00
impl shuffle_wall for super::RemoteReducers {
fn shuffle_wall(&self) -> __sdk::Result<()> {
self.imp.call_reducer("shuffle_wall", ShuffleWallArgs {})
2026-02-06 23:51:08 -08:00
}
2026-02-07 17:46:03 -08:00
fn on_shuffle_wall(
2026-02-06 23:51:08 -08:00
&self,
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
2026-02-07 17:46:03 -08:00
) -> ShuffleWallCallbackId {
ShuffleWallCallbackId(self.imp.on_reducer(
"shuffle_wall",
2026-02-06 23:51:08 -08:00
Box::new(move |ctx: &super::ReducerEventContext| {
#[allow(irrefutable_let_patterns)]
let super::ReducerEventContext {
event:
__sdk::ReducerEvent {
2026-02-07 17:46:03 -08:00
reducer: super::Reducer::ShuffleWall {},
2026-02-06 23:51:08 -08:00
..
},
..
} = ctx
else {
unreachable!()
};
callback(ctx)
}),
))
}
2026-02-07 17:46:03 -08:00
fn remove_on_shuffle_wall(&self, callback: ShuffleWallCallbackId) {
self.imp.remove_on_reducer("shuffle_wall", callback.0)
2026-02-06 23:51:08 -08:00
}
}
#[allow(non_camel_case_types)]
#[doc(hidden)]
2026-02-07 17:46:03 -08:00
/// Extension trait for setting the call-flags for the reducer `shuffle_wall`.
2026-02-06 23:51:08 -08:00
///
/// Implemented for [`super::SetReducerFlags`].
///
/// This type is currently unstable and may be removed without a major version bump.
2026-02-07 17:46:03 -08:00
pub trait set_flags_for_shuffle_wall {
/// Set the call-reducer flags for the reducer `shuffle_wall` to `flags`.
2026-02-06 23:51:08 -08:00
///
/// This type is currently unstable and may be removed without a major version bump.
2026-02-07 17:46:03 -08:00
fn shuffle_wall(&self, flags: __ws::CallReducerFlags);
2026-02-06 23:51:08 -08:00
}
2026-02-07 17:46:03 -08:00
impl set_flags_for_shuffle_wall for super::SetReducerFlags {
fn shuffle_wall(&self, flags: __ws::CallReducerFlags) {
self.imp.set_call_reducer_flags("shuffle_wall", flags);
2026-02-06 23:51:08 -08:00
}
}