jong/module_bindings/identity_disconnected_reducer.rs

104 lines
4.1 KiB
Rust
Raw Normal View History

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