jong/jong-db/src/db/add_bot_reducer.rs

69 lines
2.3 KiB
Rust
Raw Normal View History

2026-02-08 00:10:10 -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-08 00:10:10 -08:00
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct AddBotArgs {
pub lobby_id: u32,
}
impl From<AddBotArgs> for super::Reducer {
fn from(args: AddBotArgs) -> Self {
Self::AddBot {
lobby_id: args.lobby_id,
2026-02-22 00:08:02 -08:00
}
}
2026-02-08 00:10:10 -08:00
}
impl __sdk::InModule for AddBotArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `add_bot`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait add_bot {
/// Request that the remote module invoke the reducer `add_bot` 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,
2026-02-25 15:22:10 -08:00
/// and this method provides no way to listen for its completion status.
/// /// Use [`add_bot:add_bot_then`] to run a callback after the reducer completes.
fn add_bot(&self, lobby_id: u32) -> __sdk::Result<()> {
self.add_bot_then(lobby_id, |_, _| {})
}
/// Request that the remote module invoke the reducer `add_bot` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
2026-02-08 00:10:10 -08:00
///
2026-02-25 15:22:10 -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,
/// and its status can be observed with the `callback`.
fn add_bot_then(
2026-02-22 00:08:02 -08:00
&self,
2026-02-25 15:22:10 -08:00
lobby_id: u32,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
2026-02-08 00:10:10 -08:00
}
impl add_bot for super::RemoteReducers {
2026-02-25 15:22:10 -08:00
fn add_bot_then(
2026-02-08 00:10:10 -08:00
&self,
2026-02-25 15:22:10 -08:00
lobby_id: u32,
2026-02-08 00:10:10 -08:00
2026-02-25 15:22:10 -08:00
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(AddBotArgs { lobby_id }, callback)
2026-02-08 00:10:10 -08:00
}
}