jong/jong-db/src/db/join_or_create_lobby_reducer.rs

69 lines
2.5 KiB
Rust
Raw Normal View History

2026-02-07 22:45:43 -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-07 22:45:43 -08:00
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub(super) struct JoinOrCreateLobbyArgs {
2026-02-08 20:21:23 -08:00
pub lobby_id: u32,
2026-02-07 22:45:43 -08:00
}
impl From<JoinOrCreateLobbyArgs> for super::Reducer {
fn from(args: JoinOrCreateLobbyArgs) -> Self {
2026-02-08 20:21:23 -08:00
Self::JoinOrCreateLobby {
lobby_id: args.lobby_id,
2026-02-22 00:08:02 -08:00
}
}
2026-02-07 22:45:43 -08:00
}
impl __sdk::InModule for JoinOrCreateLobbyArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the reducer `join_or_create_lobby`.
///
/// Implemented for [`super::RemoteReducers`].
pub trait join_or_create_lobby {
/// Request that the remote module invoke the reducer `join_or_create_lobby` 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 [`join_or_create_lobby:join_or_create_lobby_then`] to run a callback after the reducer completes.
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()> {
self.join_or_create_lobby_then(lobby_id, |_, _| {})
}
/// Request that the remote module invoke the reducer `join_or_create_lobby` to run as soon as possible,
/// registering `callback` to run when we are notified that the reducer completed.
2026-02-07 22:45:43 -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 join_or_create_lobby_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-07 22:45:43 -08:00
}
impl join_or_create_lobby for super::RemoteReducers {
2026-02-25 15:22:10 -08:00
fn join_or_create_lobby_then(
2026-02-07 22:45:43 -08:00
&self,
2026-02-25 15:22:10 -08:00
lobby_id: u32,
2026-02-07 22:45:43 -08:00
2026-02-25 15:22:10 -08:00
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
2026-02-22 00:08:02 -08:00
self.imp
2026-02-25 15:22:10 -08:00
.invoke_reducer_with_callback(JoinOrCreateLobbyArgs { lobby_id }, callback)
2026-02-07 22:45:43 -08:00
}
}