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)]
|
|
|
|
|
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
|
|
|
|
|
|
|
|
|
#[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-07 22:45:43 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl __sdk::InModule for JoinOrCreateLobbyArgs {
|
|
|
|
|
type Module = super::RemoteModule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct JoinOrCreateLobbyCallbackId(__sdk::CallbackId);
|
|
|
|
|
|
|
|
|
|
#[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,
|
|
|
|
|
/// and its status can be observed by listening for [`Self::on_join_or_create_lobby`] callbacks.
|
2026-02-08 20:21:23 -08:00
|
|
|
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()>;
|
2026-02-07 22:45:43 -08:00
|
|
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `join_or_create_lobby`.
|
|
|
|
|
///
|
|
|
|
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
|
|
|
/// to determine the reducer's status.
|
|
|
|
|
///
|
|
|
|
|
/// The returned [`JoinOrCreateLobbyCallbackId`] can be passed to [`Self::remove_on_join_or_create_lobby`]
|
|
|
|
|
/// to cancel the callback.
|
|
|
|
|
fn on_join_or_create_lobby(
|
|
|
|
|
&self,
|
2026-02-08 20:21:23 -08:00
|
|
|
callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
2026-02-07 22:45:43 -08:00
|
|
|
) -> JoinOrCreateLobbyCallbackId;
|
|
|
|
|
/// Cancel a callback previously registered by [`Self::on_join_or_create_lobby`],
|
|
|
|
|
/// causing it not to run in the future.
|
|
|
|
|
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl join_or_create_lobby for super::RemoteReducers {
|
2026-02-08 20:21:23 -08:00
|
|
|
fn join_or_create_lobby(&self, lobby_id: u32) -> __sdk::Result<()> {
|
2026-02-07 22:45:43 -08:00
|
|
|
self.imp
|
2026-02-08 20:21:23 -08:00
|
|
|
.call_reducer("join_or_create_lobby", JoinOrCreateLobbyArgs { lobby_id })
|
2026-02-07 22:45:43 -08:00
|
|
|
}
|
|
|
|
|
fn on_join_or_create_lobby(
|
|
|
|
|
&self,
|
2026-02-08 20:21:23 -08:00
|
|
|
mut callback: impl FnMut(&super::ReducerEventContext, &u32) + Send + 'static,
|
2026-02-07 22:45:43 -08:00
|
|
|
) -> JoinOrCreateLobbyCallbackId {
|
|
|
|
|
JoinOrCreateLobbyCallbackId(self.imp.on_reducer(
|
|
|
|
|
"join_or_create_lobby",
|
|
|
|
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
|
|
|
#[allow(irrefutable_let_patterns)]
|
|
|
|
|
let super::ReducerEventContext {
|
|
|
|
|
event:
|
|
|
|
|
__sdk::ReducerEvent {
|
2026-02-08 20:21:23 -08:00
|
|
|
reducer: super::Reducer::JoinOrCreateLobby { lobby_id },
|
2026-02-07 22:45:43 -08:00
|
|
|
..
|
|
|
|
|
},
|
|
|
|
|
..
|
|
|
|
|
} = ctx
|
|
|
|
|
else {
|
|
|
|
|
unreachable!()
|
|
|
|
|
};
|
2026-02-08 20:21:23 -08:00
|
|
|
callback(ctx, lobby_id)
|
2026-02-07 22:45:43 -08:00
|
|
|
}),
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
fn remove_on_join_or_create_lobby(&self, callback: JoinOrCreateLobbyCallbackId) {
|
|
|
|
|
self.imp
|
|
|
|
|
.remove_on_reducer("join_or_create_lobby", callback.0)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
|
#[doc(hidden)]
|
|
|
|
|
/// Extension trait for setting the call-flags for the reducer `join_or_create_lobby`.
|
|
|
|
|
///
|
|
|
|
|
/// Implemented for [`super::SetReducerFlags`].
|
|
|
|
|
///
|
|
|
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
|
|
|
pub trait set_flags_for_join_or_create_lobby {
|
|
|
|
|
/// Set the call-reducer flags for the reducer `join_or_create_lobby` to `flags`.
|
|
|
|
|
///
|
|
|
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
|
|
|
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl set_flags_for_join_or_create_lobby for super::SetReducerFlags {
|
|
|
|
|
fn join_or_create_lobby(&self, flags: __ws::CallReducerFlags) {
|
|
|
|
|
self.imp
|
|
|
|
|
.set_call_reducer_flags("join_or_create_lobby", flags);
|
|
|
|
|
}
|
|
|
|
|
}
|