This commit is contained in:
Tao Tien 2026-02-22 00:08:02 -08:00
parent d1446309c4
commit d7b4221727
41 changed files with 893 additions and 1673 deletions

View file

@ -2,13 +2,7 @@
// 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,
};
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@ -18,10 +12,8 @@ pub(super) struct SetReadyArgs {
impl From<SetReadyArgs> for super::Reducer {
fn from(args: SetReadyArgs) -> Self {
Self::SetReady {
ready: args.ready,
}
}
Self::SetReady { ready: args.ready }
}
}
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.
/// The reducer will run asynchronously in the future,
/// and its status can be observed by listening for [`Self::on_set_ready`] callbacks.
fn set_ready(&self, ready: bool,
) -> __sdk::Result<()>;
fn set_ready(&self, ready: bool) -> __sdk::Result<()>;
/// 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`]
@ -49,35 +40,39 @@ pub trait set_ready {
///
/// The returned [`SetReadyCallbackId`] can be passed to [`Self::remove_on_set_ready`]
/// 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`],
/// causing it not to run in the future.
fn remove_on_set_ready(&self, callback: SetReadyCallbackId);
}
impl set_ready for super::RemoteReducers {
fn set_ready(&self, ready: bool,
) -> __sdk::Result<()> {
self.imp.call_reducer("set_ready", SetReadyArgs { ready, })
fn set_ready(&self, ready: bool) -> __sdk::Result<()> {
self.imp.call_reducer("set_ready", SetReadyArgs { ready })
}
fn on_set_ready(
&self,
mut callback: impl FnMut(&super::ReducerEventContext, &bool, ) + Send + 'static,
mut callback: impl FnMut(&super::ReducerEventContext, &bool) + Send + 'static,
) -> SetReadyCallbackId {
SetReadyCallbackId(self.imp.on_reducer(
"set_ready",
Box::new(move |ctx: &super::ReducerEventContext| {
#[allow(irrefutable_let_patterns)]
let super::ReducerEventContext {
event: __sdk::ReducerEvent {
reducer: super::Reducer::SetReady {
ready,
event:
__sdk::ReducerEvent {
reducer: super::Reducer::SetReady { ready },
..
},
..
},
..
} = ctx else { unreachable!() };
callback(ctx, ready, )
} = ctx
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);
}
}