71 lines
2.5 KiB
Rust
71 lines
2.5 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};
|
|
|
|
use super::activity_type::Activity;
|
|
|
|
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
|
#[sats(crate = __lib)]
|
|
pub(super) struct UpdateActivityArgs {
|
|
pub activity: Activity,
|
|
}
|
|
|
|
impl From<UpdateActivityArgs> for super::Reducer {
|
|
fn from(args: UpdateActivityArgs) -> Self {
|
|
Self::UpdateActivity {
|
|
activity: args.activity,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl __sdk::InModule for UpdateActivityArgs {
|
|
type Module = super::RemoteModule;
|
|
}
|
|
|
|
#[allow(non_camel_case_types)]
|
|
/// Extension trait for access to the reducer `update_activity`.
|
|
///
|
|
/// Implemented for [`super::RemoteReducers`].
|
|
pub trait update_activity {
|
|
/// Request that the remote module invoke the reducer `update_activity` 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 this method provides no way to listen for its completion status.
|
|
/// /// Use [`update_activity:update_activity_then`] to run a callback after the reducer completes.
|
|
fn update_activity(&self, activity: Activity) -> __sdk::Result<()> {
|
|
self.update_activity_then(activity, |_, _| {})
|
|
}
|
|
|
|
/// Request that the remote module invoke the reducer `update_activity` to run as soon as possible,
|
|
/// registering `callback` to run when we are notified that the reducer completed.
|
|
///
|
|
/// 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 update_activity_then(
|
|
&self,
|
|
activity: Activity,
|
|
|
|
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
|
+ Send
|
|
+ 'static,
|
|
) -> __sdk::Result<()>;
|
|
}
|
|
|
|
impl update_activity for super::RemoteReducers {
|
|
fn update_activity_then(
|
|
&self,
|
|
activity: Activity,
|
|
|
|
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
|
|
+ Send
|
|
+ 'static,
|
|
) -> __sdk::Result<()> {
|
|
self.imp
|
|
.invoke_reducer_with_callback(UpdateActivityArgs { activity }, callback)
|
|
}
|
|
}
|