103 lines
4 KiB
Rust
103 lines
4 KiB
Rust
// 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 LoginOrAddPlayerArgs {}
|
|
|
|
impl From<LoginOrAddPlayerArgs> for super::Reducer {
|
|
fn from(args: LoginOrAddPlayerArgs) -> Self {
|
|
Self::LoginOrAddPlayer
|
|
}
|
|
}
|
|
|
|
impl __sdk::InModule for LoginOrAddPlayerArgs {
|
|
type Module = super::RemoteModule;
|
|
}
|
|
|
|
pub struct LoginOrAddPlayerCallbackId(__sdk::CallbackId);
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the reducer `login_or_add_player`.
|
|
///
|
|
/// Implemented for [`super::RemoteReducers`].
|
|
pub trait login_or_add_player {
|
|
/// Request that the remote module invoke the reducer `login_or_add_player` 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_login_or_add_player`] callbacks.
|
|
fn login_or_add_player(&self) -> __sdk::Result<()>;
|
|
/// Register a callback to run whenever we are notified of an invocation of the reducer `login_or_add_player`.
|
|
///
|
|
/// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`]
|
|
/// to determine the reducer's status.
|
|
///
|
|
/// The returned [`LoginOrAddPlayerCallbackId`] can be passed to [`Self::remove_on_login_or_add_player`]
|
|
/// to cancel the callback.
|
|
fn on_login_or_add_player(
|
|
&self,
|
|
callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
) -> LoginOrAddPlayerCallbackId;
|
|
/// Cancel a callback previously registered by [`Self::on_login_or_add_player`],
|
|
/// causing it not to run in the future.
|
|
fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId);
|
|
}
|
|
|
|
impl login_or_add_player for super::RemoteReducers {
|
|
fn login_or_add_player(&self) -> __sdk::Result<()> {
|
|
self.imp
|
|
.call_reducer("login_or_add_player", LoginOrAddPlayerArgs {})
|
|
}
|
|
fn on_login_or_add_player(
|
|
&self,
|
|
mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static,
|
|
) -> LoginOrAddPlayerCallbackId {
|
|
LoginOrAddPlayerCallbackId(self.imp.on_reducer(
|
|
"login_or_add_player",
|
|
Box::new(move |ctx: &super::ReducerEventContext| {
|
|
#[allow(irrefutable_let_patterns)]
|
|
let super::ReducerEventContext {
|
|
event:
|
|
__sdk::ReducerEvent {
|
|
reducer: super::Reducer::LoginOrAddPlayer {},
|
|
..
|
|
},
|
|
..
|
|
} = ctx
|
|
else {
|
|
unreachable!()
|
|
};
|
|
callback(ctx)
|
|
}),
|
|
))
|
|
}
|
|
fn remove_on_login_or_add_player(&self, callback: LoginOrAddPlayerCallbackId) {
|
|
self.imp
|
|
.remove_on_reducer("login_or_add_player", callback.0)
|
|
}
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
#[doc(hidden)]
|
|
/// Extension trait for setting the call-flags for the reducer `login_or_add_player`.
|
|
///
|
|
/// Implemented for [`super::SetReducerFlags`].
|
|
///
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
pub trait set_flags_for_login_or_add_player {
|
|
/// Set the call-reducer flags for the reducer `login_or_add_player` to `flags`.
|
|
///
|
|
/// This type is currently unstable and may be removed without a major version bump.
|
|
fn login_or_add_player(&self, flags: __ws::CallReducerFlags);
|
|
}
|
|
|
|
impl set_flags_for_login_or_add_player for super::SetReducerFlags {
|
|
fn login_or_add_player(&self, flags: __ws::CallReducerFlags) {
|
|
self.imp
|
|
.set_call_reducer_flags("login_or_add_player", flags);
|
|
}
|
|
}
|