diff --git a/crates/cli/src/subcommands/generate/rust.rs b/crates/cli/src/subcommands/generate/rust.rs index fb0231938a..f948c6760f 100644 --- a/crates/cli/src/subcommands/generate/rust.rs +++ b/crates/cli/src/subcommands/generate/rust.rs @@ -59,7 +59,7 @@ Requested namespace: {namespace}", AlgebraicTypeDef::Product(product) => { gen_and_print_imports(module, out, &product.elements, &[typ.ty]); out.newline(); - define_struct_for_product(module, out, &type_name, &product.elements); + define_struct_for_product(module, out, &type_name, &product.elements, "pub"); } AlgebraicTypeDef::Sum(sum) => { gen_and_print_imports(module, out, &sum.variants, &[typ.ty]); @@ -130,7 +130,7 @@ Requested namespace: {namespace}", let table_handle = table_name_pascalcase.clone() + "TableHandle"; let insert_callback_id = table_name_pascalcase.clone() + "InsertCallbackId"; let delete_callback_id = table_name_pascalcase.clone() + "DeleteCallbackId"; - let accessor_trait = table_name_pascalcase.clone() + "TableAccess"; + let accessor_trait = table_access_trait_name(&table.name); let accessor_method = table_method_name(&table.name); write!( @@ -353,14 +353,31 @@ Requested namespace: {namespace}", let reducer_name = reducer.name.deref(); let func_name = reducer_function_name(reducer); - let set_reducer_flags_trait = format!("set_flags_for_{func_name}"); + let set_reducer_flags_trait = reducer_flags_trait_name(reducer); let args_type = reducer_args_type_name(&reducer.name); - - define_struct_for_product(module, out, &args_type, &reducer.params_for_generate.elements); + let enum_variant_name = reducer_variant_name(&reducer.name); + + // Define an "args struct" for the reducer. + // This is not user-facing (note the `pub(super)` visibility); + // it is an internal helper for serialization and deserialization. + // We actually want to ser/de instances of `enum Reducer`, but: + // - `Reducer` will have struct-like variants, which SATS ser/de does not support. + // - The WS format does not contain a BSATN-serialized `Reducer` instance; + // it holds the reducer name or ID separately from the argument bytes. + // We could work up some magic with `DeserializeSeed` + // and/or custom `Serializer` and `Deserializer` types + // to account for this, but it's much easier to just use an intermediate struct per reducer. + define_struct_for_product( + module, + out, + &args_type, + &reducer.params_for_generate.elements, + "pub(super)", + ); out.newline(); - let callback_id = args_type.clone() + "CallbackId"; + let callback_id = reducer_callback_id_name(&reducer.name); // The reducer arguments as `ident: ty, ident: ty, ident: ty,`, // like an argument list. @@ -373,10 +390,6 @@ Requested namespace: {namespace}", // The reducer argument names as `ident, ident, ident`, // for passing to function call and struct literal expressions. let mut arg_names_list = String::new(); - // The reducer argument names as `&args.ident, &args.ident, &args.ident`, - // for extracting from a structure named `args` by reference - // and passing to a function call. - let mut unboxed_arg_refs = String::new(); for (arg_ident, arg_ty) in &reducer.params_for_generate.elements[..] { arg_types_ref_list += "&"; write_type(module, &mut arg_types_ref_list, arg_ty).unwrap(); @@ -385,12 +398,40 @@ Requested namespace: {namespace}", let arg_name = arg_ident.deref().to_case(Case::Snake); arg_names_list += &arg_name; arg_names_list += ", "; - - unboxed_arg_refs += "&args."; - unboxed_arg_refs += &arg_name; - unboxed_arg_refs += ", "; } + write!(out, "impl From<{args_type}> for super::Reducer "); + out.delimited_block( + "{", + |out| { + write!(out, "fn from(args: {args_type}) -> Self "); + out.delimited_block( + "{", + |out| { + write!(out, "Self::{enum_variant_name}"); + if !reducer.params_for_generate.elements.is_empty() { + // We generate "struct variants" for reducers with arguments, + // but "unit variants" for reducers of no arguments. + // These use different constructor syntax. + out.delimited_block( + " {", + |out| { + for (arg_ident, _ty) in &reducer.params_for_generate.elements[..] { + let arg_name = arg_ident.deref().to_case(Case::Snake); + writeln!(out, "{arg_name}: args.{arg_name},"); + } + }, + "}", + ); + } + out.newline(); + }, + "}\n", + ); + }, + "}\n", + ); + // TODO: check for lifecycle reducers and do not generate the invoke method. writeln!( @@ -437,13 +478,24 @@ impl {func_name} for super::RemoteReducers {{ &self, mut callback: impl FnMut(&super::EventContext, {arg_types_ref_list}) + Send + 'static, ) -> {callback_id} {{ - {callback_id}(self.imp.on_reducer::<{args_type}>( + {callback_id}(self.imp.on_reducer( {reducer_name:?}, - Box::new(move |ctx: &super::EventContext, args: &{args_type}| callback(ctx, {unboxed_arg_refs})), + Box::new(move |ctx: &super::EventContext| {{ + let super::EventContext {{ + event: __sdk::Event::Reducer(__sdk::ReducerEvent {{ + reducer: super::Reducer::{enum_variant_name} {{ + {arg_names_list} + }}, + .. + }}), + .. + }} = ctx else {{ unreachable!() }}; + callback(ctx, {arg_names_list}) + }}), )) }} fn remove_on_{func_name}(&self, callback: {callback_id}) {{ - self.imp.remove_on_reducer::<{args_type}>({reducer_name:?}, callback.0) + self.imp.remove_on_reducer({reducer_name:?}, callback.0) }} }} @@ -714,10 +766,11 @@ fn define_struct_for_product( out: &mut Indenter, name: &str, elements: &[(Identifier, AlgebraicTypeUse)], + vis: &str, ) { print_struct_derives(out); - write!(out, "pub struct {name} "); + write!(out, "{vis} struct {name} "); // TODO: if elements is empty, define a unit struct with no brace-delimited list of fields. write_struct_type_fields_in_braces( @@ -744,14 +797,22 @@ fn table_method_name(table_name: &Identifier) -> String { table_name.deref().to_case(Case::Snake) } +fn table_access_trait_name(table_name: &Identifier) -> String { + table_name.deref().to_case(Case::Pascal) + "TableAccess" +} + fn reducer_args_type_name(reducer_name: &Identifier) -> String { - reducer_name.deref().to_case(Case::Pascal) + reducer_name.deref().to_case(Case::Pascal) + "Args" } fn reducer_variant_name(reducer_name: &Identifier) -> String { reducer_name.deref().to_case(Case::Pascal) } +fn reducer_callback_id_name(reducer_name: &Identifier) -> String { + reducer_name.deref().to_case(Case::Pascal) + "CallbackId" +} + fn reducer_module_name(reducer_name: &Identifier) -> String { reducer_name.deref().to_case(Case::Snake) + "_reducer" } @@ -760,6 +821,10 @@ fn reducer_function_name(reducer: &ReducerDef) -> String { reducer.name.deref().to_case(Case::Snake) } +fn reducer_flags_trait_name(reducer: &ReducerDef) -> String { + format!("set_flags_for_{}", reducer_function_name(reducer)) +} + /// Iterate over all of the Rust `mod`s for types, reducers and tables in the `module`. fn iter_module_names(module: &ModuleDef) -> impl Iterator + '_ { itertools::chain!( @@ -776,10 +841,31 @@ fn print_module_decls(module: &ModuleDef, out: &mut Indenter) { } } -/// Print `pub use *` declarations for all the files that will be generated for `items`. +/// Print appropriate reexports for all the files that will be generated for `items`. fn print_module_reexports(module: &ModuleDef, out: &mut Indenter) { - for module_name in iter_module_names(module) { - writeln!(out, "pub use {module_name}::*;"); + for ty in module.types().sorted_by_key(|ty| &ty.name) { + let mod_name = type_module_name(&ty.name); + let type_name = collect_case(Case::Pascal, ty.name.name_segments()); + writeln!(out, "pub use {mod_name}::{type_name};") + } + for table in iter_tables(module) { + let mod_name = table_module_name(&table.name); + // TODO: More precise reexport: we want: + // - The trait name. + // - The insert, delete and possibly update callback ids. + // We do not want: + // - The table handle. + writeln!(out, "pub use {mod_name}::*;"); + } + for reducer in iter_reducers(module) { + let mod_name = reducer_module_name(&reducer.name); + let reducer_trait_name = reducer_function_name(reducer); + let flags_trait_name = reducer_flags_trait_name(reducer); + let callback_id_name = reducer_callback_id_name(&reducer.name); + writeln!( + out, + "pub use {mod_name}::{{{reducer_trait_name}, {flags_trait_name}, {callback_id_name}}};" + ); } } @@ -814,7 +900,9 @@ fn iter_unique_cols<'a>( } fn print_reducer_enum_defn(module: &ModuleDef, out: &mut Indenter) { - print_enum_derives(out); + // Don't derive ser/de on this enum; + // it's not a proper SATS enum and the derive will fail. + writeln!(out, "#[derive(Clone, PartialEq, Debug)]"); writeln!( out, " @@ -828,13 +916,15 @@ fn print_reducer_enum_defn(module: &ModuleDef, out: &mut Indenter) { "pub enum Reducer {", |out| { for reducer in iter_reducers(module) { - writeln!( - out, - "{}({}::{}),", - reducer_variant_name(&reducer.name), - reducer_module_name(&reducer.name), - reducer_args_type_name(&reducer.name), - ); + write!(out, "{} ", reducer_variant_name(&reducer.name)); + if !reducer.params_for_generate.elements.is_empty() { + // If the reducer has any arguments, generate a "struct variant," + // like `Foo { bar: Baz, }`. + // If it doesn't, generate a "unit variant" instead, + // like `Foo,`. + write_struct_type_fields_in_braces(module, out, &reducer.params_for_generate.elements, false); + } + writeln!(out, ","); } }, "}\n", @@ -859,27 +949,17 @@ impl __sdk::InModule for Reducer {{ "match self {", |out| { for reducer in iter_reducers(module) { - writeln!( - out, - "Reducer::{}(_) => {:?},", - reducer_variant_name(&reducer.name), - reducer.name.deref(), - ); - } - }, - "}\n", - ); - }, - "}\n", - ); - out.delimited_block( - "fn reducer_args(&self) -> &dyn std::any::Any {", - |out| { - out.delimited_block( - "match self {", - |out| { - for reducer in iter_reducers(module) { - writeln!(out, "Reducer::{}(args) => args,", reducer_variant_name(&reducer.name)); + write!(out, "Reducer::{}", reducer_variant_name(&reducer.name)); + if !reducer.params_for_generate.elements.is_empty() { + // Because we're emitting unit variants when the payload is empty, + // we will emit different patterns for empty vs non-empty variants. + // This is not strictly required; + // Rust allows matching a struct-like pattern + // against a unit-like enum variant, + // but we prefer the clarity of not including the braces for unit variants. + write!(out, " {{ .. }}"); + } + writeln!(out, " => {:?},", reducer.name.deref()); } }, "}\n", @@ -895,6 +975,21 @@ impl __sdk::InModule for Reducer {{ "impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer {", |out| { writeln!(out, "type Error = __anyhow::Error;"); + // We define an "args struct" for each reducer in `generate_reducer`. + // This is not user-facing, and is not exported past the "root" `mod.rs`; + // it is an internal helper for serialization and deserialization. + // We actually want to ser/de instances of `enum Reducer`, but: + // + // - `Reducer` will have struct-like variants, which SATS ser/de does not support. + // - The WS format does not contain a BSATN-serialized `Reducer` instance; + // it holds the reducer name or ID separately from the argument bytes. + // We could work up some magic with `DeserializeSeed` + // and/or custom `Serializer` and `Deserializer` types + // to account for this, but it's much easier to just use an intermediate struct per reducer. + // + // As such, we deserialize from the `value.args` bytes into that "args struct," + // then convert it into a `Reducer` variant via `Into::into`, + // which we also implement in `generate_reducer`. out.delimited_block( "fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result {", |out| { @@ -904,9 +999,10 @@ impl __sdk::InModule for Reducer {{ for reducer in iter_reducers(module) { writeln!( out, - "{:?} => Ok(Reducer::{}(__sdk::parse_reducer_args({:?}, &value.args)?)),", + "{:?} => Ok(__sdk::parse_reducer_args::<{}::{}>({:?}, &value.args)?.into()),", reducer.name.deref(), - reducer_variant_name(&reducer.name), + reducer_module_name(&reducer.name), + reducer_args_type_name(&reducer.name), reducer.name.deref(), ); } diff --git a/crates/cli/tests/snapshots/codegen__codegen_rust.snap b/crates/cli/tests/snapshots/codegen__codegen_rust.snap index 89a0bb6c56..45ccd00817 100644 --- a/crates/cli/tests/snapshots/codegen__codegen_rust.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_rust.snap @@ -17,12 +17,19 @@ expression: outfiles #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct AddPlayer { +pub(super) struct AddPlayerArgs { pub name: String, } +impl From for super::Reducer { + fn from(args: AddPlayerArgs) -> Self { + Self::AddPlayer { + name: args.name, +} +} +} -impl __sdk::InModule for AddPlayer { +impl __sdk::InModule for AddPlayerArgs { type Module = super::RemoteModule; } @@ -59,19 +66,30 @@ pub trait add_player { impl add_player for super::RemoteReducers { fn add_player(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("add_player", AddPlayer { name, }) + self.imp.call_reducer("add_player", AddPlayerArgs { name, }) } fn on_add_player( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> AddPlayerCallbackId { - AddPlayerCallbackId(self.imp.on_reducer::( + AddPlayerCallbackId(self.imp.on_reducer( "add_player", - Box::new(move |ctx: &super::EventContext, args: &AddPlayer| callback(ctx, &args.name, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::AddPlayer { + name, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, name, ) + }), )) } fn remove_on_add_player(&self, callback: AddPlayerCallbackId) { - self.imp.remove_on_reducer::("add_player", callback.0) + self.imp.remove_on_reducer("add_player", callback.0) } } @@ -111,12 +129,19 @@ impl set_flags_for_add_player for super::SetReducerFlags { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct AddPrivate { +pub(super) struct AddPrivateArgs { pub name: String, } +impl From for super::Reducer { + fn from(args: AddPrivateArgs) -> Self { + Self::AddPrivate { + name: args.name, +} +} +} -impl __sdk::InModule for AddPrivate { +impl __sdk::InModule for AddPrivateArgs { type Module = super::RemoteModule; } @@ -153,19 +178,30 @@ pub trait add_private { impl add_private for super::RemoteReducers { fn add_private(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("add_private", AddPrivate { name, }) + self.imp.call_reducer("add_private", AddPrivateArgs { name, }) } fn on_add_private( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> AddPrivateCallbackId { - AddPrivateCallbackId(self.imp.on_reducer::( + AddPrivateCallbackId(self.imp.on_reducer( "add_private", - Box::new(move |ctx: &super::EventContext, args: &AddPrivate| callback(ctx, &args.name, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::AddPrivate { + name, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, name, ) + }), )) } fn remove_on_add_private(&self, callback: AddPrivateCallbackId) { - self.imp.remove_on_reducer::("add_private", callback.0) + self.imp.remove_on_reducer("add_private", callback.0) } } @@ -230,12 +266,19 @@ impl __sdk::InModule for Baz { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePlayer { +pub(super) struct DeletePlayerArgs { pub id: u64, } +impl From for super::Reducer { + fn from(args: DeletePlayerArgs) -> Self { + Self::DeletePlayer { + id: args.id, +} +} +} -impl __sdk::InModule for DeletePlayer { +impl __sdk::InModule for DeletePlayerArgs { type Module = super::RemoteModule; } @@ -272,19 +315,30 @@ pub trait delete_player { impl delete_player for super::RemoteReducers { fn delete_player(&self, id: u64, ) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_player", DeletePlayer { id, }) + self.imp.call_reducer("delete_player", DeletePlayerArgs { id, }) } fn on_delete_player( &self, mut callback: impl FnMut(&super::EventContext, &u64, ) + Send + 'static, ) -> DeletePlayerCallbackId { - DeletePlayerCallbackId(self.imp.on_reducer::( + DeletePlayerCallbackId(self.imp.on_reducer( "delete_player", - Box::new(move |ctx: &super::EventContext, args: &DeletePlayer| callback(ctx, &args.id, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePlayer { + id, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, id, ) + }), )) } fn remove_on_delete_player(&self, callback: DeletePlayerCallbackId) { - self.imp.remove_on_reducer::("delete_player", callback.0) + self.imp.remove_on_reducer("delete_player", callback.0) } } @@ -324,12 +378,19 @@ impl set_flags_for_delete_player for super::SetReducerFlags { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePlayersByName { +pub(super) struct DeletePlayersByNameArgs { pub name: String, } +impl From for super::Reducer { + fn from(args: DeletePlayersByNameArgs) -> Self { + Self::DeletePlayersByName { + name: args.name, +} +} +} -impl __sdk::InModule for DeletePlayersByName { +impl __sdk::InModule for DeletePlayersByNameArgs { type Module = super::RemoteModule; } @@ -366,19 +427,30 @@ pub trait delete_players_by_name { impl delete_players_by_name for super::RemoteReducers { fn delete_players_by_name(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_players_by_name", DeletePlayersByName { name, }) + self.imp.call_reducer("delete_players_by_name", DeletePlayersByNameArgs { name, }) } fn on_delete_players_by_name( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> DeletePlayersByNameCallbackId { - DeletePlayersByNameCallbackId(self.imp.on_reducer::( + DeletePlayersByNameCallbackId(self.imp.on_reducer( "delete_players_by_name", - Box::new(move |ctx: &super::EventContext, args: &DeletePlayersByName| callback(ctx, &args.name, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePlayersByName { + name, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, name, ) + }), )) } fn remove_on_delete_players_by_name(&self, callback: DeletePlayersByNameCallbackId) { - self.imp.remove_on_reducer::("delete_players_by_name", callback.0) + self.imp.remove_on_reducer("delete_players_by_name", callback.0) } } @@ -571,11 +643,16 @@ impl __sdk::InModule for HasSpecialStuff { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct IdentityConnected { +pub(super) struct IdentityConnectedArgs { } +impl From for super::Reducer { + fn from(args: IdentityConnectedArgs) -> Self { + Self::IdentityConnected +} +} -impl __sdk::InModule for IdentityConnected { +impl __sdk::InModule for IdentityConnectedArgs { type Module = super::RemoteModule; } @@ -610,19 +687,30 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected { }) + self.imp.call_reducer("__identity_connected__", IdentityConnectedArgs { }) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> IdentityConnectedCallbackId { - IdentityConnectedCallbackId(self.imp.on_reducer::( + IdentityConnectedCallbackId(self.imp.on_reducer( "__identity_connected__", - Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::IdentityConnected { + + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, ) + }), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp.remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer("__identity_connected__", callback.0) } } @@ -662,11 +750,16 @@ impl set_flags_for_identity_connected for super::SetReducerFlags { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct Init { +pub(super) struct InitArgs { } +impl From for super::Reducer { + fn from(args: InitArgs) -> Self { + Self::Init +} +} -impl __sdk::InModule for Init { +impl __sdk::InModule for InitArgs { type Module = super::RemoteModule; } @@ -701,19 +794,30 @@ pub trait init { impl init for super::RemoteReducers { fn init(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("__init__", Init { }) + self.imp.call_reducer("__init__", InitArgs { }) } fn on_init( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> InitCallbackId { - InitCallbackId(self.imp.on_reducer::( + InitCallbackId(self.imp.on_reducer( "__init__", - Box::new(move |ctx: &super::EventContext, args: &Init| callback(ctx, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::Init { + + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, ) + }), )) } fn remove_on_init(&self, callback: InitCallbackId) { - self.imp.remove_on_reducer::("__init__", callback.0) + self.imp.remove_on_reducer("__init__", callback.0) } } @@ -784,30 +888,20 @@ pub mod test_d_table; pub mod test_e_table; pub mod test_f_table; -pub use baz_type::*; -pub use foobar_type::*; -pub use has_special_stuff_type::*; -pub use namespace_test_c_type::*; -pub use namespace_test_f_type::*; -pub use pk_multi_identity_type::*; -pub use point_type::*; -pub use private_type::*; -pub use repeating_test_arg_type::*; -pub use test_a_type::*; -pub use test_b_type::*; -pub use test_d_type::*; -pub use test_e_type::*; -pub use test_foobar_type::*; -pub use add_player_reducer::*; -pub use add_private_reducer::*; -pub use delete_player_reducer::*; -pub use delete_players_by_name_reducer::*; -pub use identity_connected_reducer::*; -pub use init_reducer::*; -pub use query_private_reducer::*; -pub use repeating_test_reducer::*; -pub use test_btree_index_args_reducer::*; -pub use test_reducer::*; +pub use baz_type::Baz; +pub use foobar_type::Foobar; +pub use has_special_stuff_type::HasSpecialStuff; +pub use pk_multi_identity_type::PkMultiIdentity; +pub use point_type::Point; +pub use private_type::Private; +pub use repeating_test_arg_type::RepeatingTestArg; +pub use test_a_type::TestA; +pub use test_b_type::TestB; +pub use test_d_type::TestD; +pub use test_e_type::TestE; +pub use test_foobar_type::TestFoobar; +pub use namespace_test_c_type::NamespaceTestC; +pub use namespace_test_f_type::NamespaceTestF; pub use has_special_stuff_table::*; pub use pk_multi_identity_table::*; pub use points_table::*; @@ -817,9 +911,18 @@ pub use test_a_table::*; pub use test_d_table::*; pub use test_e_table::*; pub use test_f_table::*; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] +pub use identity_connected_reducer::{identity_connected, set_flags_for_identity_connected, IdentityConnectedCallbackId}; +pub use init_reducer::{init, set_flags_for_init, InitCallbackId}; +pub use add_player_reducer::{add_player, set_flags_for_add_player, AddPlayerCallbackId}; +pub use add_private_reducer::{add_private, set_flags_for_add_private, AddPrivateCallbackId}; +pub use delete_player_reducer::{delete_player, set_flags_for_delete_player, DeletePlayerCallbackId}; +pub use delete_players_by_name_reducer::{delete_players_by_name, set_flags_for_delete_players_by_name, DeletePlayersByNameCallbackId}; +pub use query_private_reducer::{query_private, set_flags_for_query_private, QueryPrivateCallbackId}; +pub use repeating_test_reducer::{repeating_test, set_flags_for_repeating_test, RepeatingTestCallbackId}; +pub use test_reducer::{test, set_flags_for_test, TestCallbackId}; +pub use test_btree_index_args_reducer::{test_btree_index_args, set_flags_for_test_btree_index_args, TestBtreeIndexArgsCallbackId}; + +#[derive(Clone, PartialEq, Debug)] /// One of the reducers defined by this module. /// @@ -827,16 +930,31 @@ pub use test_f_table::*; /// to indicate which reducer caused the event. pub enum Reducer { - IdentityConnected(identity_connected_reducer::IdentityConnected), - Init(init_reducer::Init), - AddPlayer(add_player_reducer::AddPlayer), - AddPrivate(add_private_reducer::AddPrivate), - DeletePlayer(delete_player_reducer::DeletePlayer), - DeletePlayersByName(delete_players_by_name_reducer::DeletePlayersByName), - QueryPrivate(query_private_reducer::QueryPrivate), - RepeatingTest(repeating_test_reducer::RepeatingTest), - Test(test_reducer::Test), - TestBtreeIndexArgs(test_btree_index_args_reducer::TestBtreeIndexArgs), + IdentityConnected , + Init , + AddPlayer { + name: String, +} , + AddPrivate { + name: String, +} , + DeletePlayer { + id: u64, +} , + DeletePlayersByName { + name: String, +} , + QueryPrivate , + RepeatingTest { + arg: RepeatingTestArg, +} , + Test { + arg: TestA, + arg_2: TestB, + arg_3: NamespaceTestC, + arg_4: NamespaceTestF, +} , + TestBtreeIndexArgs , } @@ -847,30 +965,16 @@ impl __sdk::InModule for Reducer { impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::Init(_) => "__init__", - Reducer::AddPlayer(_) => "add_player", - Reducer::AddPrivate(_) => "add_private", - Reducer::DeletePlayer(_) => "delete_player", - Reducer::DeletePlayersByName(_) => "delete_players_by_name", - Reducer::QueryPrivate(_) => "query_private", - Reducer::RepeatingTest(_) => "repeating_test", - Reducer::Test(_) => "test", - Reducer::TestBtreeIndexArgs(_) => "test_btree_index_args", -} -} -fn reducer_args(&self) -> &dyn std::any::Any { - match self { - Reducer::IdentityConnected(args) => args, - Reducer::Init(args) => args, - Reducer::AddPlayer(args) => args, - Reducer::AddPrivate(args) => args, - Reducer::DeletePlayer(args) => args, - Reducer::DeletePlayersByName(args) => args, - Reducer::QueryPrivate(args) => args, - Reducer::RepeatingTest(args) => args, - Reducer::Test(args) => args, - Reducer::TestBtreeIndexArgs(args) => args, + Reducer::IdentityConnected => "__identity_connected__", + Reducer::Init => "__init__", + Reducer::AddPlayer { .. } => "add_player", + Reducer::AddPrivate { .. } => "add_private", + Reducer::DeletePlayer { .. } => "delete_player", + Reducer::DeletePlayersByName { .. } => "delete_players_by_name", + Reducer::QueryPrivate => "query_private", + Reducer::RepeatingTest { .. } => "repeating_test", + Reducer::Test { .. } => "test", + Reducer::TestBtreeIndexArgs => "test_btree_index_args", } } } @@ -878,16 +982,16 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { type Error = __anyhow::Error; fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::parse_reducer_args("__identity_connected__", &value.args)?)), - "__init__" => Ok(Reducer::Init(__sdk::parse_reducer_args("__init__", &value.args)?)), - "add_player" => Ok(Reducer::AddPlayer(__sdk::parse_reducer_args("add_player", &value.args)?)), - "add_private" => Ok(Reducer::AddPrivate(__sdk::parse_reducer_args("add_private", &value.args)?)), - "delete_player" => Ok(Reducer::DeletePlayer(__sdk::parse_reducer_args("delete_player", &value.args)?)), - "delete_players_by_name" => Ok(Reducer::DeletePlayersByName(__sdk::parse_reducer_args("delete_players_by_name", &value.args)?)), - "query_private" => Ok(Reducer::QueryPrivate(__sdk::parse_reducer_args("query_private", &value.args)?)), - "repeating_test" => Ok(Reducer::RepeatingTest(__sdk::parse_reducer_args("repeating_test", &value.args)?)), - "test" => Ok(Reducer::Test(__sdk::parse_reducer_args("test", &value.args)?)), - "test_btree_index_args" => Ok(Reducer::TestBtreeIndexArgs(__sdk::parse_reducer_args("test_btree_index_args", &value.args)?)), + "__identity_connected__" => Ok(__sdk::parse_reducer_args::("__identity_connected__", &value.args)?.into()), + "__init__" => Ok(__sdk::parse_reducer_args::("__init__", &value.args)?.into()), + "add_player" => Ok(__sdk::parse_reducer_args::("add_player", &value.args)?.into()), + "add_private" => Ok(__sdk::parse_reducer_args::("add_private", &value.args)?.into()), + "delete_player" => Ok(__sdk::parse_reducer_args::("delete_player", &value.args)?.into()), + "delete_players_by_name" => Ok(__sdk::parse_reducer_args::("delete_players_by_name", &value.args)?.into()), + "query_private" => Ok(__sdk::parse_reducer_args::("query_private", &value.args)?.into()), + "repeating_test" => Ok(__sdk::parse_reducer_args::("repeating_test", &value.args)?.into()), + "test" => Ok(__sdk::parse_reducer_args::("test", &value.args)?.into()), + "test_btree_index_args" => Ok(__sdk::parse_reducer_args::("test_btree_index_args", &value.args)?.into()), _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), } } @@ -1807,11 +1911,16 @@ impl __sdk::InModule for Private { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct QueryPrivate { +pub(super) struct QueryPrivateArgs { } +impl From for super::Reducer { + fn from(args: QueryPrivateArgs) -> Self { + Self::QueryPrivate +} +} -impl __sdk::InModule for QueryPrivate { +impl __sdk::InModule for QueryPrivateArgs { type Module = super::RemoteModule; } @@ -1846,19 +1955,30 @@ pub trait query_private { impl query_private for super::RemoteReducers { fn query_private(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("query_private", QueryPrivate { }) + self.imp.call_reducer("query_private", QueryPrivateArgs { }) } fn on_query_private( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> QueryPrivateCallbackId { - QueryPrivateCallbackId(self.imp.on_reducer::( + QueryPrivateCallbackId(self.imp.on_reducer( "query_private", - Box::new(move |ctx: &super::EventContext, args: &QueryPrivate| callback(ctx, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::QueryPrivate { + + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, ) + }), )) } fn remove_on_query_private(&self, callback: QueryPrivateCallbackId) { - self.imp.remove_on_reducer::("query_private", callback.0) + self.imp.remove_on_reducer("query_private", callback.0) } } @@ -2071,12 +2191,19 @@ use super::repeating_test_arg_type::RepeatingTestArg; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct RepeatingTest { +pub(super) struct RepeatingTestArgs { pub arg: RepeatingTestArg, } +impl From for super::Reducer { + fn from(args: RepeatingTestArgs) -> Self { + Self::RepeatingTest { + arg: args.arg, +} +} +} -impl __sdk::InModule for RepeatingTest { +impl __sdk::InModule for RepeatingTestArgs { type Module = super::RemoteModule; } @@ -2113,19 +2240,30 @@ pub trait repeating_test { impl repeating_test for super::RemoteReducers { fn repeating_test(&self, arg: RepeatingTestArg, ) -> __anyhow::Result<()> { - self.imp.call_reducer("repeating_test", RepeatingTest { arg, }) + self.imp.call_reducer("repeating_test", RepeatingTestArgs { arg, }) } fn on_repeating_test( &self, mut callback: impl FnMut(&super::EventContext, &RepeatingTestArg, ) + Send + 'static, ) -> RepeatingTestCallbackId { - RepeatingTestCallbackId(self.imp.on_reducer::( + RepeatingTestCallbackId(self.imp.on_reducer( "repeating_test", - Box::new(move |ctx: &super::EventContext, args: &RepeatingTest| callback(ctx, &args.arg, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::RepeatingTest { + arg, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, arg, ) + }), )) } fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId) { - self.imp.remove_on_reducer::("repeating_test", callback.0) + self.imp.remove_on_reducer("repeating_test", callback.0) } } @@ -2312,11 +2450,16 @@ impl __sdk::InModule for TestB { #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct TestBtreeIndexArgs { +pub(super) struct TestBtreeIndexArgsArgs { } +impl From for super::Reducer { + fn from(args: TestBtreeIndexArgsArgs) -> Self { + Self::TestBtreeIndexArgs +} +} -impl __sdk::InModule for TestBtreeIndexArgs { +impl __sdk::InModule for TestBtreeIndexArgsArgs { type Module = super::RemoteModule; } @@ -2351,19 +2494,30 @@ pub trait test_btree_index_args { impl test_btree_index_args for super::RemoteReducers { fn test_btree_index_args(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("test_btree_index_args", TestBtreeIndexArgs { }) + self.imp.call_reducer("test_btree_index_args", TestBtreeIndexArgsArgs { }) } fn on_test_btree_index_args( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> TestBtreeIndexArgsCallbackId { - TestBtreeIndexArgsCallbackId(self.imp.on_reducer::( + TestBtreeIndexArgsCallbackId(self.imp.on_reducer( "test_btree_index_args", - Box::new(move |ctx: &super::EventContext, args: &TestBtreeIndexArgs| callback(ctx, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::TestBtreeIndexArgs { + + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, ) + }), )) } fn remove_on_test_btree_index_args(&self, callback: TestBtreeIndexArgsCallbackId) { - self.imp.remove_on_reducer::("test_btree_index_args", callback.0) + self.imp.remove_on_reducer("test_btree_index_args", callback.0) } } @@ -2822,15 +2976,25 @@ use super::namespace_test_f_type::NamespaceTestF; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct Test { +pub(super) struct TestArgs { pub arg: TestA, pub arg_2: TestB, pub arg_3: NamespaceTestC, pub arg_4: NamespaceTestF, } +impl From for super::Reducer { + fn from(args: TestArgs) -> Self { + Self::Test { + arg: args.arg, + arg_2: args.arg_2, + arg_3: args.arg_3, + arg_4: args.arg_4, +} +} +} -impl __sdk::InModule for Test { +impl __sdk::InModule for TestArgs { type Module = super::RemoteModule; } @@ -2873,19 +3037,30 @@ arg_2: TestB, arg_3: NamespaceTestC, arg_4: NamespaceTestF, ) -> __anyhow::Result<()> { - self.imp.call_reducer("test", Test { arg, arg_2, arg_3, arg_4, }) + self.imp.call_reducer("test", TestArgs { arg, arg_2, arg_3, arg_4, }) } fn on_test( &self, mut callback: impl FnMut(&super::EventContext, &TestA, &TestB, &NamespaceTestC, &NamespaceTestF, ) + Send + 'static, ) -> TestCallbackId { - TestCallbackId(self.imp.on_reducer::( + TestCallbackId(self.imp.on_reducer( "test", - Box::new(move |ctx: &super::EventContext, args: &Test| callback(ctx, &args.arg, &args.arg_2, &args.arg_3, &args.arg_4, )), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::Test { + arg, arg_2, arg_3, arg_4, + }, + .. + }), + .. + } = ctx else { unreachable!() }; + callback(ctx, arg, arg_2, arg_3, arg_4, ) + }), )) } fn remove_on_test(&self, callback: TestCallbackId) { - self.imp.remove_on_reducer::("test", callback.0) + self.imp.remove_on_reducer("test", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs index da91d7eed9..fafba96a97 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct IdentityConnected {} +pub(super) struct IdentityConnectedArgs {} -impl __sdk::InModule for IdentityConnected { +impl From for super::Reducer { + fn from(args: IdentityConnectedArgs) -> Self { + Self::IdentityConnected + } +} + +impl __sdk::InModule for IdentityConnectedArgs { type Module = super::RemoteModule; } @@ -49,20 +55,33 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected {}) + self.imp + .call_reducer("__identity_connected__", IdentityConnectedArgs {}) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityConnectedCallbackId { - IdentityConnectedCallbackId(self.imp.on_reducer::( + IdentityConnectedCallbackId(self.imp.on_reducer( "__identity_connected__", - Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::IdentityConnected {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer("__identity_connected__", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs index a902e247a7..0f48475e77 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct IdentityDisconnected {} +pub(super) struct IdentityDisconnectedArgs {} -impl __sdk::InModule for IdentityDisconnected { +impl From for super::Reducer { + fn from(args: IdentityDisconnectedArgs) -> Self { + Self::IdentityDisconnected + } +} + +impl __sdk::InModule for IdentityDisconnectedArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait identity_disconnected { impl identity_disconnected for super::RemoteReducers { fn identity_disconnected(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("__identity_disconnected__", IdentityDisconnected {}) + .call_reducer("__identity_disconnected__", IdentityDisconnectedArgs {}) } fn on_identity_disconnected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityDisconnectedCallbackId { - IdentityDisconnectedCallbackId(self.imp.on_reducer::( + IdentityDisconnectedCallbackId(self.imp.on_reducer( "__identity_disconnected__", - Box::new(move |ctx: &super::EventContext, args: &IdentityDisconnected| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__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) + self.imp.remove_on_reducer("__identity_disconnected__", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs index fda5feaaa5..50081594cf 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct Init {} +pub(super) struct InitArgs {} -impl __sdk::InModule for Init { +impl From for super::Reducer { + fn from(args: InitArgs) -> Self { + Self::Init + } +} + +impl __sdk::InModule for InitArgs { type Module = super::RemoteModule; } @@ -46,16 +52,29 @@ pub trait init { impl init for super::RemoteReducers { fn init(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__init__", Init {}) + self.imp.call_reducer("__init__", InitArgs {}) } fn on_init(&self, mut callback: impl FnMut(&super::EventContext) + Send + 'static) -> InitCallbackId { - InitCallbackId(self.imp.on_reducer::( + InitCallbackId(self.imp.on_reducer( "__init__", - Box::new(move |ctx: &super::EventContext, args: &Init| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::Init {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_init(&self, callback: InitCallbackId) { - self.imp.remove_on_reducer::("__init__", callback.0) + self.imp.remove_on_reducer("__init__", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs b/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs index 77adc0728c..dba79d38c0 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs @@ -17,18 +17,21 @@ pub mod set_name_reducer; pub mod user_table; pub mod user_type; -pub use identity_connected_reducer::*; -pub use identity_disconnected_reducer::*; -pub use init_reducer::*; +pub use identity_connected_reducer::{ + identity_connected, set_flags_for_identity_connected, IdentityConnectedCallbackId, +}; +pub use identity_disconnected_reducer::{ + identity_disconnected, set_flags_for_identity_disconnected, IdentityDisconnectedCallbackId, +}; +pub use init_reducer::{init, set_flags_for_init, InitCallbackId}; pub use message_table::*; -pub use message_type::*; -pub use send_message_reducer::*; -pub use set_name_reducer::*; +pub use message_type::Message; +pub use send_message_reducer::{send_message, set_flags_for_send_message, SendMessageCallbackId}; +pub use set_name_reducer::{set_flags_for_set_name, set_name, SetNameCallbackId}; pub use user_table::*; -pub use user_type::*; +pub use user_type::User; -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] +#[derive(Clone, PartialEq, Debug)] /// One of the reducers defined by this module. /// @@ -36,11 +39,11 @@ pub use user_type::*; /// to indicate which reducer caused the event. pub enum Reducer { - IdentityConnected(identity_connected_reducer::IdentityConnected), - IdentityDisconnected(identity_disconnected_reducer::IdentityDisconnected), - Init(init_reducer::Init), - SendMessage(send_message_reducer::SendMessage), - SetName(set_name_reducer::SetName), + IdentityConnected, + IdentityDisconnected, + Init, + SendMessage { text: String }, + SetName { name: String }, } impl __sdk::InModule for Reducer { @@ -50,20 +53,11 @@ impl __sdk::InModule for Reducer { impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::IdentityDisconnected(_) => "__identity_disconnected__", - Reducer::Init(_) => "__init__", - Reducer::SendMessage(_) => "send_message", - Reducer::SetName(_) => "set_name", - } - } - fn reducer_args(&self) -> &dyn std::any::Any { - match self { - Reducer::IdentityConnected(args) => args, - Reducer::IdentityDisconnected(args) => args, - Reducer::Init(args) => args, - Reducer::SendMessage(args) => args, - Reducer::SetName(args) => args, + Reducer::IdentityConnected => "__identity_connected__", + Reducer::IdentityDisconnected => "__identity_disconnected__", + Reducer::Init => "__init__", + Reducer::SendMessage { .. } => "send_message", + Reducer::SetName { .. } => "set_name", } } } @@ -71,20 +65,23 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { type Error = __anyhow::Error; fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::parse_reducer_args( - "__identity_connected__", - &value.args, - )?)), - "__identity_disconnected__" => Ok(Reducer::IdentityDisconnected(__sdk::parse_reducer_args( - "__identity_disconnected__", - &value.args, - )?)), - "__init__" => Ok(Reducer::Init(__sdk::parse_reducer_args("__init__", &value.args)?)), - "send_message" => Ok(Reducer::SendMessage(__sdk::parse_reducer_args( + "__identity_connected__" => Ok(__sdk::parse_reducer_args::< + identity_connected_reducer::IdentityConnectedArgs, + >("__identity_connected__", &value.args)? + .into()), + "__identity_disconnected__" => Ok(__sdk::parse_reducer_args::< + identity_disconnected_reducer::IdentityDisconnectedArgs, + >("__identity_disconnected__", &value.args)? + .into()), + "__init__" => Ok(__sdk::parse_reducer_args::("__init__", &value.args)?.into()), + "send_message" => Ok(__sdk::parse_reducer_args::( "send_message", &value.args, - )?)), - "set_name" => Ok(Reducer::SetName(__sdk::parse_reducer_args("set_name", &value.args)?)), + )? + .into()), + "set_name" => { + Ok(__sdk::parse_reducer_args::("set_name", &value.args)?.into()) + } _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs index c5c27e7c4a..092afad3a8 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct SendMessage { +pub(super) struct SendMessageArgs { pub text: String, } -impl __sdk::InModule for SendMessage { +impl From for super::Reducer { + fn from(args: SendMessageArgs) -> Self { + Self::SendMessage { text: args.text } + } +} + +impl __sdk::InModule for SendMessageArgs { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait send_message { impl send_message for super::RemoteReducers { fn send_message(&self, text: String) -> __anyhow::Result<()> { - self.imp.call_reducer("send_message", SendMessage { text }) + self.imp.call_reducer("send_message", SendMessageArgs { text }) } fn on_send_message( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> SendMessageCallbackId { - SendMessageCallbackId(self.imp.on_reducer::( + SendMessageCallbackId(self.imp.on_reducer( "send_message", - Box::new(move |ctx: &super::EventContext, args: &SendMessage| callback(ctx, &args.text)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::SendMessage { text }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, text) + }), )) } fn remove_on_send_message(&self, callback: SendMessageCallbackId) { - self.imp.remove_on_reducer::("send_message", callback.0) + self.imp.remove_on_reducer("send_message", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs index 48766d10d6..f195ee2914 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct SetName { +pub(super) struct SetNameArgs { pub name: String, } -impl __sdk::InModule for SetName { +impl From for super::Reducer { + fn from(args: SetNameArgs) -> Self { + Self::SetName { name: args.name } + } +} + +impl __sdk::InModule for SetNameArgs { type Module = super::RemoteModule; } @@ -48,19 +54,32 @@ pub trait set_name { impl set_name for super::RemoteReducers { fn set_name(&self, name: String) -> __anyhow::Result<()> { - self.imp.call_reducer("set_name", SetName { name }) + self.imp.call_reducer("set_name", SetNameArgs { name }) } fn on_set_name( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> SetNameCallbackId { - SetNameCallbackId(self.imp.on_reducer::( + SetNameCallbackId(self.imp.on_reducer( "set_name", - Box::new(move |ctx: &super::EventContext, args: &SetName| callback(ctx, &args.name)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::SetName { name }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, name) + }), )) } fn remove_on_set_name(&self, callback: SetNameCallbackId) { - self.imp.remove_on_reducer::("set_name", callback.0) + self.imp.remove_on_reducer("set_name", callback.0) } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs b/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs index 9a03844430..d0396024c2 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UserTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("user"); - _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity) + _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity); } pub struct UserUpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/src/callbacks.rs b/crates/sdk/src/callbacks.rs index 13e55eb1c1..01175af130 100644 --- a/crates/sdk/src/callbacks.rs +++ b/crates/sdk/src/callbacks.rs @@ -201,10 +201,10 @@ impl TableCallbacks { /// A reducer callback for a reducer defined by the module `M`. /// -/// Reducer arguments are passed to callbacks as `&dyn Any` to the argument product, -/// and a wrapper inserted by the SDK will downcast and unpack the arguments +/// Reducer arguments are passed to callbacks within the `EventContext`, +/// and a wrapper inserted by the SDK will destructure the contained `Event` /// before invoking the user-supplied function. -pub(crate) type ReducerCallback = Box::EventContext, &dyn Any) + Send + 'static>; +pub(crate) type ReducerCallback = Box::EventContext) + Send + 'static>; type ReducerCallbackMap = HashMap>; @@ -228,10 +228,9 @@ impl Default for ReducerCallbacks { impl ReducerCallbacks { pub(crate) fn invoke_on_reducer(&mut self, ctx: &M::EventContext, reducer: &M::Reducer) { let name = reducer.reducer_name(); - let args = reducer.reducer_args(); if let Some(callbacks) = self.callbacks.get_mut(name) { for callback in callbacks.values_mut() { - callback(ctx, args); + callback(ctx); } } } diff --git a/crates/sdk/src/db_connection.rs b/crates/sdk/src/db_connection.rs index 44d73b69c3..ca9ffdbb28 100644 --- a/crates/sdk/src/db_connection.rs +++ b/crates/sdk/src/db_connection.rs @@ -33,7 +33,7 @@ use futures_channel::mpsc; use http::Uri; use spacetimedb_client_api_messages::websocket as ws; use spacetimedb_client_api_messages::websocket::{BsatnFormat, CallReducerFlags, Compression}; -use spacetimedb_lib::{bsatn, de::Deserialize, ser::Serialize, Address, Identity}; +use spacetimedb_lib::{bsatn, ser::Serialize, Address, Identity}; use std::{ collections::HashMap, sync::{Arc, Mutex as StdMutex, OnceLock}, @@ -546,25 +546,18 @@ impl DbContextImpl { } /// Called by autogenerated reducer callback methods. - pub fn on_reducer + InModule + 'static>( - &self, - reducer_name: &'static str, - mut callback: impl FnMut(&M::EventContext, &Args) + Send + 'static, - ) -> CallbackId { + pub fn on_reducer(&self, reducer_name: &'static str, callback: ReducerCallback) -> CallbackId { let callback_id = CallbackId::get_next(); self.queue_mutation(PendingMutation::AddReducerCallback { reducer: reducer_name, callback_id, - callback: Box::new(move |ctx, args| { - let args = args.downcast_ref::().unwrap(); - callback(ctx, args); - }), + callback, }); callback_id } /// Called by autogenerated reducer callback methods. - pub fn remove_on_reducer>(&self, reducer_name: &'static str, callback: CallbackId) { + pub fn remove_on_reducer(&self, reducer_name: &'static str, callback: CallbackId) { self.queue_mutation(PendingMutation::RemoveReducerCallback { reducer: reducer_name, callback_id: callback, diff --git a/crates/sdk/src/spacetime_module.rs b/crates/sdk/src/spacetime_module.rs index 68e74a050a..1f7a1c6944 100644 --- a/crates/sdk/src/spacetime_module.rs +++ b/crates/sdk/src/spacetime_module.rs @@ -11,7 +11,7 @@ use bytes::Bytes; use spacetimedb_client_api_messages::websocket::{self as ws, RowListLen as _}; use spacetimedb_data_structures::map::{DefaultHashBuilder, HashCollectionExt, HashMap}; use spacetimedb_lib::{bsatn, de::DeserializeOwned}; -use std::{any::Any, fmt::Debug, hash::Hash}; +use std::{fmt::Debug, hash::Hash}; /// Marker trait for any item defined in a module, /// to conveniently get the types of various per-module things. @@ -107,11 +107,6 @@ where /// /// Used by [`crate::callbacks::ReducerCallbacks::invoke_on_reducer`] to determine which callback to run. fn reducer_name(&self) -> &'static str; - /// Get a reference to the reducer argument struct for the variant stored in this instance. - /// - /// Used by [`crate::callbacks::ReducerCallbacks::invoke_on_reducer`] - /// to pass the reducer arguments to the callback. - fn reducer_args(&self) -> &dyn Any; } pub trait SubscriptionHandle: InModule + Send + 'static diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs index da91d7eed9..fafba96a97 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct IdentityConnected {} +pub(super) struct IdentityConnectedArgs {} -impl __sdk::InModule for IdentityConnected { +impl From for super::Reducer { + fn from(args: IdentityConnectedArgs) -> Self { + Self::IdentityConnected + } +} + +impl __sdk::InModule for IdentityConnectedArgs { type Module = super::RemoteModule; } @@ -49,20 +55,33 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected {}) + self.imp + .call_reducer("__identity_connected__", IdentityConnectedArgs {}) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityConnectedCallbackId { - IdentityConnectedCallbackId(self.imp.on_reducer::( + IdentityConnectedCallbackId(self.imp.on_reducer( "__identity_connected__", - Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::IdentityConnected {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer("__identity_connected__", callback.0) } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs index a902e247a7..0f48475e77 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct IdentityDisconnected {} +pub(super) struct IdentityDisconnectedArgs {} -impl __sdk::InModule for IdentityDisconnected { +impl From for super::Reducer { + fn from(args: IdentityDisconnectedArgs) -> Self { + Self::IdentityDisconnected + } +} + +impl __sdk::InModule for IdentityDisconnectedArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait identity_disconnected { impl identity_disconnected for super::RemoteReducers { fn identity_disconnected(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("__identity_disconnected__", IdentityDisconnected {}) + .call_reducer("__identity_disconnected__", IdentityDisconnectedArgs {}) } fn on_identity_disconnected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityDisconnectedCallbackId { - IdentityDisconnectedCallbackId(self.imp.on_reducer::( + IdentityDisconnectedCallbackId(self.imp.on_reducer( "__identity_disconnected__", - Box::new(move |ctx: &super::EventContext, args: &IdentityDisconnected| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__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) + self.imp.remove_on_reducer("__identity_disconnected__", callback.0) } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs index e58c81b3ca..4e8fc490e3 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs @@ -15,14 +15,17 @@ pub mod identity_connected_reducer; pub mod identity_disconnected_reducer; pub use connected_table::*; -pub use connected_type::*; +pub use connected_type::Connected; pub use disconnected_table::*; -pub use disconnected_type::*; -pub use identity_connected_reducer::*; -pub use identity_disconnected_reducer::*; +pub use disconnected_type::Disconnected; +pub use identity_connected_reducer::{ + identity_connected, set_flags_for_identity_connected, IdentityConnectedCallbackId, +}; +pub use identity_disconnected_reducer::{ + identity_disconnected, set_flags_for_identity_disconnected, IdentityDisconnectedCallbackId, +}; -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] +#[derive(Clone, PartialEq, Debug)] /// One of the reducers defined by this module. /// @@ -30,8 +33,8 @@ pub use identity_disconnected_reducer::*; /// to indicate which reducer caused the event. pub enum Reducer { - IdentityConnected(identity_connected_reducer::IdentityConnected), - IdentityDisconnected(identity_disconnected_reducer::IdentityDisconnected), + IdentityConnected, + IdentityDisconnected, } impl __sdk::InModule for Reducer { @@ -41,14 +44,8 @@ impl __sdk::InModule for Reducer { impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::IdentityDisconnected(_) => "__identity_disconnected__", - } - } - fn reducer_args(&self) -> &dyn std::any::Any { - match self { - Reducer::IdentityConnected(args) => args, - Reducer::IdentityDisconnected(args) => args, + Reducer::IdentityConnected => "__identity_connected__", + Reducer::IdentityDisconnected => "__identity_disconnected__", } } } @@ -56,14 +53,14 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { type Error = __anyhow::Error; fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::parse_reducer_args( - "__identity_connected__", - &value.args, - )?)), - "__identity_disconnected__" => Ok(Reducer::IdentityDisconnected(__sdk::parse_reducer_args( - "__identity_disconnected__", - &value.args, - )?)), + "__identity_connected__" => Ok(__sdk::parse_reducer_args::< + identity_connected_reducer::IdentityConnectedArgs, + >("__identity_connected__", &value.args)? + .into()), + "__identity_disconnected__" => Ok(__sdk::parse_reducer_args::< + identity_disconnected_reducer::IdentityDisconnectedArgs, + >("__identity_disconnected__", &value.args)? + .into()), _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), } } diff --git a/crates/sdk/tests/test-client/src/main.rs b/crates/sdk/tests/test-client/src/main.rs index 1f34fc1de3..ac98f57de1 100644 --- a/crates/sdk/tests/test-client/src/main.rs +++ b/crates/sdk/tests/test-client/src/main.rs @@ -510,7 +510,7 @@ fn exec_insert_caller_identity() { move |ctx| { subscribe_all_then(ctx, move |ctx| { on_insert_one::(ctx, &test_counter, ctx.identity(), |event| { - matches!(event, Reducer::InsertCallerOneIdentity(_)) + matches!(event, Reducer::InsertCallerOneIdentity) }); ctx.reducers.insert_caller_one_identity().unwrap(); @@ -595,7 +595,7 @@ fn exec_insert_caller_address() { move |ctx| { subscribe_all_then(ctx, move |ctx| { on_insert_one::(ctx, &test_counter, ctx.address(), |event| { - matches!(event, Reducer::InsertCallerOneAddress(_)) + matches!(event, Reducer::InsertCallerOneAddress) }); ctx.reducers.insert_caller_one_address().unwrap(); sub_applied_nothing_result(assert_all_tables_empty(ctx)); @@ -695,7 +695,7 @@ fn exec_on_reducer() { reducer_event.status ); } - let expected_reducer = Reducer::InsertOneU8(InsertOneU8 { n: value }); + let expected_reducer = Reducer::InsertOneU8 { n: value }; if reducer_event.reducer != expected_reducer { anyhow::bail!( "Unexpected Reducer in ReducerEvent: expected {expected_reducer:?} but found {:?}", @@ -778,10 +778,10 @@ fn exec_fail_reducer() { reducer_event.status ); } - let expected_reducer = Reducer::InsertPkU8(InsertPkU8 { + let expected_reducer = Reducer::InsertPkU8 { n: key, data: initial_data, - }); + }; if reducer_event.reducer != expected_reducer { anyhow::bail!( "Unexpected Reducer in ReducerEvent: expected {expected_reducer:?} but found {:?}", @@ -844,10 +844,10 @@ fn exec_fail_reducer() { reducer_event.status ); } - let expected_reducer = Reducer::InsertPkU8(InsertPkU8 { + let expected_reducer = Reducer::InsertPkU8 { n: key, data: fail_data, - }); + }; if reducer_event.reducer != expected_reducer { anyhow::bail!( "Unexpected Reducer in ReducerEvent: expected {expected_reducer:?} but found {:?}", @@ -1204,7 +1204,7 @@ fn exec_insert_long_table() { if !matches!( ctx.event, Event::Reducer(ReducerEvent { - reducer: Reducer::InsertLargeTable(_), + reducer: Reducer::InsertLargeTable { .. }, .. }) ) { @@ -1291,7 +1291,7 @@ fn exec_insert_primitives_as_strings() { ctx.event, Event::Reducer(ReducerEvent { status: Status::Committed, - reducer: Reducer::InsertPrimitivesAsStrings(_), + reducer: Reducer::InsertPrimitivesAsStrings { .. }, .. }) ) { @@ -1548,7 +1548,7 @@ fn exec_caller_always_notified() { (no_op_result.take().unwrap())(match ctx.event { Event::Reducer(ReducerEvent { status: Status::Committed, - reducer: Reducer::NoOpSucceeds(_), + reducer: Reducer::NoOpSucceeds, .. }) => Ok(()), _ => Err(anyhow::anyhow!( diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs index a61ab4c16e..1bc3d87da5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkAddress { +pub(super) struct DeletePkAddressArgs { pub a: __sdk::Address, } -impl __sdk::InModule for DeletePkAddress { +impl From for super::Reducer { + fn from(args: DeletePkAddressArgs) -> Self { + Self::DeletePkAddress { a: args.a } + } +} + +impl __sdk::InModule for DeletePkAddressArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_pk_address { impl delete_pk_address for super::RemoteReducers { fn delete_pk_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_address", DeletePkAddress { a }) + self.imp.call_reducer("delete_pk_address", DeletePkAddressArgs { a }) } fn on_delete_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> DeletePkAddressCallbackId { - DeletePkAddressCallbackId(self.imp.on_reducer::( + DeletePkAddressCallbackId(self.imp.on_reducer( "delete_pk_address", - Box::new(move |ctx: &super::EventContext, args: &DeletePkAddress| callback(ctx, &args.a)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkAddress { a }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a) + }), )) } fn remove_on_delete_pk_address(&self, callback: DeletePkAddressCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_address", callback.0) + self.imp.remove_on_reducer("delete_pk_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs index fea9194881..7d863f3f89 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkBool { +pub(super) struct DeletePkBoolArgs { pub b: bool, } -impl __sdk::InModule for DeletePkBool { +impl From for super::Reducer { + fn from(args: DeletePkBoolArgs) -> Self { + Self::DeletePkBool { b: args.b } + } +} + +impl __sdk::InModule for DeletePkBoolArgs { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_bool { impl delete_pk_bool for super::RemoteReducers { fn delete_pk_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_bool", DeletePkBool { b }) + self.imp.call_reducer("delete_pk_bool", DeletePkBoolArgs { b }) } fn on_delete_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> DeletePkBoolCallbackId { - DeletePkBoolCallbackId(self.imp.on_reducer::( + DeletePkBoolCallbackId(self.imp.on_reducer( "delete_pk_bool", - Box::new(move |ctx: &super::EventContext, args: &DeletePkBool| callback(ctx, &args.b)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkBool { b }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b) + }), )) } fn remove_on_delete_pk_bool(&self, callback: DeletePkBoolCallbackId) { - self.imp.remove_on_reducer::("delete_pk_bool", callback.0) + self.imp.remove_on_reducer("delete_pk_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs index ba84dd74ac..68d01c64ba 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI128 { +pub(super) struct DeletePkI128Args { pub n: i128, } -impl __sdk::InModule for DeletePkI128 { +impl From for super::Reducer { + fn from(args: DeletePkI128Args) -> Self { + Self::DeletePkI128 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI128Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_128 { impl delete_pk_i_128 for super::RemoteReducers { fn delete_pk_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i128", DeletePkI128 { n }) + self.imp.call_reducer("delete_pk_i128", DeletePkI128Args { n }) } fn on_delete_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> DeletePkI128CallbackId { - DeletePkI128CallbackId(self.imp.on_reducer::( + DeletePkI128CallbackId(self.imp.on_reducer( "delete_pk_i128", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_128(&self, callback: DeletePkI128CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i128", callback.0) + self.imp.remove_on_reducer("delete_pk_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs index 80c956e835..1dc0b9eaf5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI16 { +pub(super) struct DeletePkI16Args { pub n: i16, } -impl __sdk::InModule for DeletePkI16 { +impl From for super::Reducer { + fn from(args: DeletePkI16Args) -> Self { + Self::DeletePkI16 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_16 { impl delete_pk_i_16 for super::RemoteReducers { fn delete_pk_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i16", DeletePkI16 { n }) + self.imp.call_reducer("delete_pk_i16", DeletePkI16Args { n }) } fn on_delete_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> DeletePkI16CallbackId { - DeletePkI16CallbackId(self.imp.on_reducer::( + DeletePkI16CallbackId(self.imp.on_reducer( "delete_pk_i16", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_16(&self, callback: DeletePkI16CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i16", callback.0) + self.imp.remove_on_reducer("delete_pk_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs index e57edb216d..71a78b041f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI256 { +pub(super) struct DeletePkI256Args { pub n: __sats::i256, } -impl __sdk::InModule for DeletePkI256 { +impl From for super::Reducer { + fn from(args: DeletePkI256Args) -> Self { + Self::DeletePkI256 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI256Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_256 { impl delete_pk_i_256 for super::RemoteReducers { fn delete_pk_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i256", DeletePkI256 { n }) + self.imp.call_reducer("delete_pk_i256", DeletePkI256Args { n }) } fn on_delete_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> DeletePkI256CallbackId { - DeletePkI256CallbackId(self.imp.on_reducer::( + DeletePkI256CallbackId(self.imp.on_reducer( "delete_pk_i256", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_256(&self, callback: DeletePkI256CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i256", callback.0) + self.imp.remove_on_reducer("delete_pk_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs index 74a39f6880..76acbb0754 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI32 { +pub(super) struct DeletePkI32Args { pub n: i32, } -impl __sdk::InModule for DeletePkI32 { +impl From for super::Reducer { + fn from(args: DeletePkI32Args) -> Self { + Self::DeletePkI32 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_32 { impl delete_pk_i_32 for super::RemoteReducers { fn delete_pk_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i32", DeletePkI32 { n }) + self.imp.call_reducer("delete_pk_i32", DeletePkI32Args { n }) } fn on_delete_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> DeletePkI32CallbackId { - DeletePkI32CallbackId(self.imp.on_reducer::( + DeletePkI32CallbackId(self.imp.on_reducer( "delete_pk_i32", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_32(&self, callback: DeletePkI32CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i32", callback.0) + self.imp.remove_on_reducer("delete_pk_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs index 5f988786ad..d95f7495d5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI64 { +pub(super) struct DeletePkI64Args { pub n: i64, } -impl __sdk::InModule for DeletePkI64 { +impl From for super::Reducer { + fn from(args: DeletePkI64Args) -> Self { + Self::DeletePkI64 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_64 { impl delete_pk_i_64 for super::RemoteReducers { fn delete_pk_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i64", DeletePkI64 { n }) + self.imp.call_reducer("delete_pk_i64", DeletePkI64Args { n }) } fn on_delete_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> DeletePkI64CallbackId { - DeletePkI64CallbackId(self.imp.on_reducer::( + DeletePkI64CallbackId(self.imp.on_reducer( "delete_pk_i64", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_64(&self, callback: DeletePkI64CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i64", callback.0) + self.imp.remove_on_reducer("delete_pk_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs index 9ea8b01e97..70be2f42e3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkI8 { +pub(super) struct DeletePkI8Args { pub n: i8, } -impl __sdk::InModule for DeletePkI8 { +impl From for super::Reducer { + fn from(args: DeletePkI8Args) -> Self { + Self::DeletePkI8 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkI8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_i_8 { impl delete_pk_i_8 for super::RemoteReducers { fn delete_pk_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i8", DeletePkI8 { n }) + self.imp.call_reducer("delete_pk_i8", DeletePkI8Args { n }) } fn on_delete_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> DeletePkI8CallbackId { - DeletePkI8CallbackId(self.imp.on_reducer::( + DeletePkI8CallbackId(self.imp.on_reducer( "delete_pk_i8", - Box::new(move |ctx: &super::EventContext, args: &DeletePkI8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkI8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_i_8(&self, callback: DeletePkI8CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i8", callback.0) + self.imp.remove_on_reducer("delete_pk_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs index 012b19933f..438c52fcc7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkIdentity { +pub(super) struct DeletePkIdentityArgs { pub i: __sdk::Identity, } -impl __sdk::InModule for DeletePkIdentity { +impl From for super::Reducer { + fn from(args: DeletePkIdentityArgs) -> Self { + Self::DeletePkIdentity { i: args.i } + } +} + +impl __sdk::InModule for DeletePkIdentityArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_pk_identity { impl delete_pk_identity for super::RemoteReducers { fn delete_pk_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_identity", DeletePkIdentity { i }) + self.imp.call_reducer("delete_pk_identity", DeletePkIdentityArgs { i }) } fn on_delete_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> DeletePkIdentityCallbackId { - DeletePkIdentityCallbackId(self.imp.on_reducer::( + DeletePkIdentityCallbackId(self.imp.on_reducer( "delete_pk_identity", - Box::new(move |ctx: &super::EventContext, args: &DeletePkIdentity| callback(ctx, &args.i)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkIdentity { i }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i) + }), )) } fn remove_on_delete_pk_identity(&self, callback: DeletePkIdentityCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_identity", callback.0) + self.imp.remove_on_reducer("delete_pk_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs index 5a1f43ce2d..cb91771edb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkString { +pub(super) struct DeletePkStringArgs { pub s: String, } -impl __sdk::InModule for DeletePkString { +impl From for super::Reducer { + fn from(args: DeletePkStringArgs) -> Self { + Self::DeletePkString { s: args.s } + } +} + +impl __sdk::InModule for DeletePkStringArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_pk_string { impl delete_pk_string for super::RemoteReducers { fn delete_pk_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_string", DeletePkString { s }) + self.imp.call_reducer("delete_pk_string", DeletePkStringArgs { s }) } fn on_delete_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> DeletePkStringCallbackId { - DeletePkStringCallbackId(self.imp.on_reducer::( + DeletePkStringCallbackId(self.imp.on_reducer( "delete_pk_string", - Box::new(move |ctx: &super::EventContext, args: &DeletePkString| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkString { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_delete_pk_string(&self, callback: DeletePkStringCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_string", callback.0) + self.imp.remove_on_reducer("delete_pk_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs index b361a8ee76..e4a5d9e9ed 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU128 { +pub(super) struct DeletePkU128Args { pub n: u128, } -impl __sdk::InModule for DeletePkU128 { +impl From for super::Reducer { + fn from(args: DeletePkU128Args) -> Self { + Self::DeletePkU128 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU128Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_128 { impl delete_pk_u_128 for super::RemoteReducers { fn delete_pk_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u128", DeletePkU128 { n }) + self.imp.call_reducer("delete_pk_u128", DeletePkU128Args { n }) } fn on_delete_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> DeletePkU128CallbackId { - DeletePkU128CallbackId(self.imp.on_reducer::( + DeletePkU128CallbackId(self.imp.on_reducer( "delete_pk_u128", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_128(&self, callback: DeletePkU128CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u128", callback.0) + self.imp.remove_on_reducer("delete_pk_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs index 7a449b5ec2..3acd5a072f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU16 { +pub(super) struct DeletePkU16Args { pub n: u16, } -impl __sdk::InModule for DeletePkU16 { +impl From for super::Reducer { + fn from(args: DeletePkU16Args) -> Self { + Self::DeletePkU16 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_16 { impl delete_pk_u_16 for super::RemoteReducers { fn delete_pk_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u16", DeletePkU16 { n }) + self.imp.call_reducer("delete_pk_u16", DeletePkU16Args { n }) } fn on_delete_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> DeletePkU16CallbackId { - DeletePkU16CallbackId(self.imp.on_reducer::( + DeletePkU16CallbackId(self.imp.on_reducer( "delete_pk_u16", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_16(&self, callback: DeletePkU16CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u16", callback.0) + self.imp.remove_on_reducer("delete_pk_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs index bb4a42adf7..5f7d227495 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU256 { +pub(super) struct DeletePkU256Args { pub n: __sats::u256, } -impl __sdk::InModule for DeletePkU256 { +impl From for super::Reducer { + fn from(args: DeletePkU256Args) -> Self { + Self::DeletePkU256 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU256Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_256 { impl delete_pk_u_256 for super::RemoteReducers { fn delete_pk_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u256", DeletePkU256 { n }) + self.imp.call_reducer("delete_pk_u256", DeletePkU256Args { n }) } fn on_delete_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> DeletePkU256CallbackId { - DeletePkU256CallbackId(self.imp.on_reducer::( + DeletePkU256CallbackId(self.imp.on_reducer( "delete_pk_u256", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_256(&self, callback: DeletePkU256CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u256", callback.0) + self.imp.remove_on_reducer("delete_pk_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs index 7b36e30c6f..374e756f88 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU32 { +pub(super) struct DeletePkU32Args { pub n: u32, } -impl __sdk::InModule for DeletePkU32 { +impl From for super::Reducer { + fn from(args: DeletePkU32Args) -> Self { + Self::DeletePkU32 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_32 { impl delete_pk_u_32 for super::RemoteReducers { fn delete_pk_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u32", DeletePkU32 { n }) + self.imp.call_reducer("delete_pk_u32", DeletePkU32Args { n }) } fn on_delete_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> DeletePkU32CallbackId { - DeletePkU32CallbackId(self.imp.on_reducer::( + DeletePkU32CallbackId(self.imp.on_reducer( "delete_pk_u32", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_32(&self, callback: DeletePkU32CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u32", callback.0) + self.imp.remove_on_reducer("delete_pk_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs index 2891524b34..5fbe132359 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU64 { +pub(super) struct DeletePkU64Args { pub n: u64, } -impl __sdk::InModule for DeletePkU64 { +impl From for super::Reducer { + fn from(args: DeletePkU64Args) -> Self { + Self::DeletePkU64 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_64 { impl delete_pk_u_64 for super::RemoteReducers { fn delete_pk_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u64", DeletePkU64 { n }) + self.imp.call_reducer("delete_pk_u64", DeletePkU64Args { n }) } fn on_delete_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> DeletePkU64CallbackId { - DeletePkU64CallbackId(self.imp.on_reducer::( + DeletePkU64CallbackId(self.imp.on_reducer( "delete_pk_u64", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_64(&self, callback: DeletePkU64CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u64", callback.0) + self.imp.remove_on_reducer("delete_pk_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs index e861f53277..de173bd273 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeletePkU8 { +pub(super) struct DeletePkU8Args { pub n: u8, } -impl __sdk::InModule for DeletePkU8 { +impl From for super::Reducer { + fn from(args: DeletePkU8Args) -> Self { + Self::DeletePkU8 { n: args.n } + } +} + +impl __sdk::InModule for DeletePkU8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait delete_pk_u_8 { impl delete_pk_u_8 for super::RemoteReducers { fn delete_pk_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u8", DeletePkU8 { n }) + self.imp.call_reducer("delete_pk_u8", DeletePkU8Args { n }) } fn on_delete_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> DeletePkU8CallbackId { - DeletePkU8CallbackId(self.imp.on_reducer::( + DeletePkU8CallbackId(self.imp.on_reducer( "delete_pk_u8", - Box::new(move |ctx: &super::EventContext, args: &DeletePkU8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeletePkU8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_pk_u_8(&self, callback: DeletePkU8CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u8", callback.0) + self.imp.remove_on_reducer("delete_pk_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs index fcc75b50f0..ab58b4c706 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueAddress { +pub(super) struct DeleteUniqueAddressArgs { pub a: __sdk::Address, } -impl __sdk::InModule for DeleteUniqueAddress { +impl From for super::Reducer { + fn from(args: DeleteUniqueAddressArgs) -> Self { + Self::DeleteUniqueAddress { a: args.a } + } +} + +impl __sdk::InModule for DeleteUniqueAddressArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait delete_unique_address { impl delete_unique_address for super::RemoteReducers { fn delete_unique_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { self.imp - .call_reducer("delete_unique_address", DeleteUniqueAddress { a }) + .call_reducer("delete_unique_address", DeleteUniqueAddressArgs { a }) } fn on_delete_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> DeleteUniqueAddressCallbackId { - DeleteUniqueAddressCallbackId(self.imp.on_reducer::( + DeleteUniqueAddressCallbackId(self.imp.on_reducer( "delete_unique_address", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueAddress| callback(ctx, &args.a)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueAddress { a }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a) + }), )) } fn remove_on_delete_unique_address(&self, callback: DeleteUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_address", callback.0) + self.imp.remove_on_reducer("delete_unique_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs index ef258cca4b..a253967ebf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueBool { +pub(super) struct DeleteUniqueBoolArgs { pub b: bool, } -impl __sdk::InModule for DeleteUniqueBool { +impl From for super::Reducer { + fn from(args: DeleteUniqueBoolArgs) -> Self { + Self::DeleteUniqueBool { b: args.b } + } +} + +impl __sdk::InModule for DeleteUniqueBoolArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_bool { impl delete_unique_bool for super::RemoteReducers { fn delete_unique_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_bool", DeleteUniqueBool { b }) + self.imp.call_reducer("delete_unique_bool", DeleteUniqueBoolArgs { b }) } fn on_delete_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> DeleteUniqueBoolCallbackId { - DeleteUniqueBoolCallbackId(self.imp.on_reducer::( + DeleteUniqueBoolCallbackId(self.imp.on_reducer( "delete_unique_bool", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueBool| callback(ctx, &args.b)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueBool { b }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b) + }), )) } fn remove_on_delete_unique_bool(&self, callback: DeleteUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_bool", callback.0) + self.imp.remove_on_reducer("delete_unique_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs index 6e5886fee6..d0665f1625 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI128 { +pub(super) struct DeleteUniqueI128Args { pub n: i128, } -impl __sdk::InModule for DeleteUniqueI128 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI128Args) -> Self { + Self::DeleteUniqueI128 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_128 { impl delete_unique_i_128 for super::RemoteReducers { fn delete_unique_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i128", DeleteUniqueI128 { n }) + self.imp.call_reducer("delete_unique_i128", DeleteUniqueI128Args { n }) } fn on_delete_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> DeleteUniqueI128CallbackId { - DeleteUniqueI128CallbackId(self.imp.on_reducer::( + DeleteUniqueI128CallbackId(self.imp.on_reducer( "delete_unique_i128", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_128(&self, callback: DeleteUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i128", callback.0) + self.imp.remove_on_reducer("delete_unique_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs index 55a9dba937..70dc6a7d01 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI16 { +pub(super) struct DeleteUniqueI16Args { pub n: i16, } -impl __sdk::InModule for DeleteUniqueI16 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI16Args) -> Self { + Self::DeleteUniqueI16 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI16Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_16 { impl delete_unique_i_16 for super::RemoteReducers { fn delete_unique_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i16", DeleteUniqueI16 { n }) + self.imp.call_reducer("delete_unique_i16", DeleteUniqueI16Args { n }) } fn on_delete_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> DeleteUniqueI16CallbackId { - DeleteUniqueI16CallbackId(self.imp.on_reducer::( + DeleteUniqueI16CallbackId(self.imp.on_reducer( "delete_unique_i16", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_16(&self, callback: DeleteUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i16", callback.0) + self.imp.remove_on_reducer("delete_unique_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs index 88c0728a18..9f68fc8d61 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI256 { +pub(super) struct DeleteUniqueI256Args { pub n: __sats::i256, } -impl __sdk::InModule for DeleteUniqueI256 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI256Args) -> Self { + Self::DeleteUniqueI256 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_256 { impl delete_unique_i_256 for super::RemoteReducers { fn delete_unique_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i256", DeleteUniqueI256 { n }) + self.imp.call_reducer("delete_unique_i256", DeleteUniqueI256Args { n }) } fn on_delete_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> DeleteUniqueI256CallbackId { - DeleteUniqueI256CallbackId(self.imp.on_reducer::( + DeleteUniqueI256CallbackId(self.imp.on_reducer( "delete_unique_i256", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_256(&self, callback: DeleteUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i256", callback.0) + self.imp.remove_on_reducer("delete_unique_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs index 88a0ff3887..d5560698d0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI32 { +pub(super) struct DeleteUniqueI32Args { pub n: i32, } -impl __sdk::InModule for DeleteUniqueI32 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI32Args) -> Self { + Self::DeleteUniqueI32 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI32Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_32 { impl delete_unique_i_32 for super::RemoteReducers { fn delete_unique_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i32", DeleteUniqueI32 { n }) + self.imp.call_reducer("delete_unique_i32", DeleteUniqueI32Args { n }) } fn on_delete_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> DeleteUniqueI32CallbackId { - DeleteUniqueI32CallbackId(self.imp.on_reducer::( + DeleteUniqueI32CallbackId(self.imp.on_reducer( "delete_unique_i32", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_32(&self, callback: DeleteUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i32", callback.0) + self.imp.remove_on_reducer("delete_unique_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs index 3f11b9067c..73f959eebd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI64 { +pub(super) struct DeleteUniqueI64Args { pub n: i64, } -impl __sdk::InModule for DeleteUniqueI64 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI64Args) -> Self { + Self::DeleteUniqueI64 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI64Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_64 { impl delete_unique_i_64 for super::RemoteReducers { fn delete_unique_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i64", DeleteUniqueI64 { n }) + self.imp.call_reducer("delete_unique_i64", DeleteUniqueI64Args { n }) } fn on_delete_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> DeleteUniqueI64CallbackId { - DeleteUniqueI64CallbackId(self.imp.on_reducer::( + DeleteUniqueI64CallbackId(self.imp.on_reducer( "delete_unique_i64", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_64(&self, callback: DeleteUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i64", callback.0) + self.imp.remove_on_reducer("delete_unique_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs index 3ddfe16372..7bc97006af 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueI8 { +pub(super) struct DeleteUniqueI8Args { pub n: i8, } -impl __sdk::InModule for DeleteUniqueI8 { +impl From for super::Reducer { + fn from(args: DeleteUniqueI8Args) -> Self { + Self::DeleteUniqueI8 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueI8Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_i_8 { impl delete_unique_i_8 for super::RemoteReducers { fn delete_unique_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i8", DeleteUniqueI8 { n }) + self.imp.call_reducer("delete_unique_i8", DeleteUniqueI8Args { n }) } fn on_delete_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> DeleteUniqueI8CallbackId { - DeleteUniqueI8CallbackId(self.imp.on_reducer::( + DeleteUniqueI8CallbackId(self.imp.on_reducer( "delete_unique_i8", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueI8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_i_8(&self, callback: DeleteUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i8", callback.0) + self.imp.remove_on_reducer("delete_unique_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs index 23ab7bf8f1..758a08aef8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueIdentity { +pub(super) struct DeleteUniqueIdentityArgs { pub i: __sdk::Identity, } -impl __sdk::InModule for DeleteUniqueIdentity { +impl From for super::Reducer { + fn from(args: DeleteUniqueIdentityArgs) -> Self { + Self::DeleteUniqueIdentity { i: args.i } + } +} + +impl __sdk::InModule for DeleteUniqueIdentityArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait delete_unique_identity { impl delete_unique_identity for super::RemoteReducers { fn delete_unique_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { self.imp - .call_reducer("delete_unique_identity", DeleteUniqueIdentity { i }) + .call_reducer("delete_unique_identity", DeleteUniqueIdentityArgs { i }) } fn on_delete_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> DeleteUniqueIdentityCallbackId { - DeleteUniqueIdentityCallbackId(self.imp.on_reducer::( + DeleteUniqueIdentityCallbackId(self.imp.on_reducer( "delete_unique_identity", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueIdentity| callback(ctx, &args.i)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueIdentity { i }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i) + }), )) } fn remove_on_delete_unique_identity(&self, callback: DeleteUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_identity", callback.0) + self.imp.remove_on_reducer("delete_unique_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs index 72a6b0f49e..948c8b1dbf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueString { +pub(super) struct DeleteUniqueStringArgs { pub s: String, } -impl __sdk::InModule for DeleteUniqueString { +impl From for super::Reducer { + fn from(args: DeleteUniqueStringArgs) -> Self { + Self::DeleteUniqueString { s: args.s } + } +} + +impl __sdk::InModule for DeleteUniqueStringArgs { type Module = super::RemoteModule; } @@ -51,20 +57,33 @@ pub trait delete_unique_string { impl delete_unique_string for super::RemoteReducers { fn delete_unique_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_string", DeleteUniqueString { s }) + self.imp + .call_reducer("delete_unique_string", DeleteUniqueStringArgs { s }) } fn on_delete_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> DeleteUniqueStringCallbackId { - DeleteUniqueStringCallbackId(self.imp.on_reducer::( + DeleteUniqueStringCallbackId(self.imp.on_reducer( "delete_unique_string", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueString| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueString { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_delete_unique_string(&self, callback: DeleteUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_string", callback.0) + self.imp.remove_on_reducer("delete_unique_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs index e02d8ca60b..ca7df9c9ac 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU128 { +pub(super) struct DeleteUniqueU128Args { pub n: u128, } -impl __sdk::InModule for DeleteUniqueU128 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU128Args) -> Self { + Self::DeleteUniqueU128 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_128 { impl delete_unique_u_128 for super::RemoteReducers { fn delete_unique_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u128", DeleteUniqueU128 { n }) + self.imp.call_reducer("delete_unique_u128", DeleteUniqueU128Args { n }) } fn on_delete_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> DeleteUniqueU128CallbackId { - DeleteUniqueU128CallbackId(self.imp.on_reducer::( + DeleteUniqueU128CallbackId(self.imp.on_reducer( "delete_unique_u128", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_128(&self, callback: DeleteUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u128", callback.0) + self.imp.remove_on_reducer("delete_unique_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs index 1d63daedd2..a100b5cfb2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU16 { +pub(super) struct DeleteUniqueU16Args { pub n: u16, } -impl __sdk::InModule for DeleteUniqueU16 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU16Args) -> Self { + Self::DeleteUniqueU16 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU16Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_16 { impl delete_unique_u_16 for super::RemoteReducers { fn delete_unique_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u16", DeleteUniqueU16 { n }) + self.imp.call_reducer("delete_unique_u16", DeleteUniqueU16Args { n }) } fn on_delete_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> DeleteUniqueU16CallbackId { - DeleteUniqueU16CallbackId(self.imp.on_reducer::( + DeleteUniqueU16CallbackId(self.imp.on_reducer( "delete_unique_u16", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_16(&self, callback: DeleteUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u16", callback.0) + self.imp.remove_on_reducer("delete_unique_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs index 7b04346f30..06b1872f96 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU256 { +pub(super) struct DeleteUniqueU256Args { pub n: __sats::u256, } -impl __sdk::InModule for DeleteUniqueU256 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU256Args) -> Self { + Self::DeleteUniqueU256 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_256 { impl delete_unique_u_256 for super::RemoteReducers { fn delete_unique_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u256", DeleteUniqueU256 { n }) + self.imp.call_reducer("delete_unique_u256", DeleteUniqueU256Args { n }) } fn on_delete_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> DeleteUniqueU256CallbackId { - DeleteUniqueU256CallbackId(self.imp.on_reducer::( + DeleteUniqueU256CallbackId(self.imp.on_reducer( "delete_unique_u256", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_256(&self, callback: DeleteUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u256", callback.0) + self.imp.remove_on_reducer("delete_unique_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs index 24f13e6977..4361cf5b70 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU32 { +pub(super) struct DeleteUniqueU32Args { pub n: u32, } -impl __sdk::InModule for DeleteUniqueU32 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU32Args) -> Self { + Self::DeleteUniqueU32 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU32Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_32 { impl delete_unique_u_32 for super::RemoteReducers { fn delete_unique_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u32", DeleteUniqueU32 { n }) + self.imp.call_reducer("delete_unique_u32", DeleteUniqueU32Args { n }) } fn on_delete_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> DeleteUniqueU32CallbackId { - DeleteUniqueU32CallbackId(self.imp.on_reducer::( + DeleteUniqueU32CallbackId(self.imp.on_reducer( "delete_unique_u32", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_32(&self, callback: DeleteUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u32", callback.0) + self.imp.remove_on_reducer("delete_unique_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs index 50febeb576..c27b2c51bb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU64 { +pub(super) struct DeleteUniqueU64Args { pub n: u64, } -impl __sdk::InModule for DeleteUniqueU64 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU64Args) -> Self { + Self::DeleteUniqueU64 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU64Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_64 { impl delete_unique_u_64 for super::RemoteReducers { fn delete_unique_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u64", DeleteUniqueU64 { n }) + self.imp.call_reducer("delete_unique_u64", DeleteUniqueU64Args { n }) } fn on_delete_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> DeleteUniqueU64CallbackId { - DeleteUniqueU64CallbackId(self.imp.on_reducer::( + DeleteUniqueU64CallbackId(self.imp.on_reducer( "delete_unique_u64", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_64(&self, callback: DeleteUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u64", callback.0) + self.imp.remove_on_reducer("delete_unique_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs index 5f3bc05fc6..fd692c260f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct DeleteUniqueU8 { +pub(super) struct DeleteUniqueU8Args { pub n: u8, } -impl __sdk::InModule for DeleteUniqueU8 { +impl From for super::Reducer { + fn from(args: DeleteUniqueU8Args) -> Self { + Self::DeleteUniqueU8 { n: args.n } + } +} + +impl __sdk::InModule for DeleteUniqueU8Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait delete_unique_u_8 { impl delete_unique_u_8 for super::RemoteReducers { fn delete_unique_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u8", DeleteUniqueU8 { n }) + self.imp.call_reducer("delete_unique_u8", DeleteUniqueU8Args { n }) } fn on_delete_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> DeleteUniqueU8CallbackId { - DeleteUniqueU8CallbackId(self.imp.on_reducer::( + DeleteUniqueU8CallbackId(self.imp.on_reducer( "delete_unique_u8", - Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::DeleteUniqueU8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_delete_unique_u_8(&self, callback: DeleteUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u8", callback.0) + self.imp.remove_on_reducer("delete_unique_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs index 08a6b073e5..5adc7f39d6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerOneAddress {} +pub(super) struct InsertCallerOneAddressArgs {} -impl __sdk::InModule for InsertCallerOneAddress { +impl From for super::Reducer { + fn from(args: InsertCallerOneAddressArgs) -> Self { + Self::InsertCallerOneAddress + } +} + +impl __sdk::InModule for InsertCallerOneAddressArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait insert_caller_one_address { impl insert_caller_one_address for super::RemoteReducers { fn insert_caller_one_address(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_one_address", InsertCallerOneAddress {}) + .call_reducer("insert_caller_one_address", InsertCallerOneAddressArgs {}) } fn on_insert_caller_one_address( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerOneAddressCallbackId { - InsertCallerOneAddressCallbackId(self.imp.on_reducer::( + InsertCallerOneAddressCallbackId(self.imp.on_reducer( "insert_caller_one_address", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerOneAddress| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerOneAddress {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_insert_caller_one_address(&self, callback: InsertCallerOneAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_one_address", callback.0) + self.imp.remove_on_reducer("insert_caller_one_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs index 34afdc452b..1e8cfc2aae 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerOneIdentity {} +pub(super) struct InsertCallerOneIdentityArgs {} -impl __sdk::InModule for InsertCallerOneIdentity { +impl From for super::Reducer { + fn from(args: InsertCallerOneIdentityArgs) -> Self { + Self::InsertCallerOneIdentity + } +} + +impl __sdk::InModule for InsertCallerOneIdentityArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait insert_caller_one_identity { impl insert_caller_one_identity for super::RemoteReducers { fn insert_caller_one_identity(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_one_identity", InsertCallerOneIdentity {}) + .call_reducer("insert_caller_one_identity", InsertCallerOneIdentityArgs {}) } fn on_insert_caller_one_identity( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerOneIdentityCallbackId { - InsertCallerOneIdentityCallbackId(self.imp.on_reducer::( + InsertCallerOneIdentityCallbackId(self.imp.on_reducer( "insert_caller_one_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerOneIdentity| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerOneIdentity {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_insert_caller_one_identity(&self, callback: InsertCallerOneIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_one_identity", callback.0) + self.imp.remove_on_reducer("insert_caller_one_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs index ccb678a48f..a96ce8ceec 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerPkAddress { +pub(super) struct InsertCallerPkAddressArgs { pub data: i32, } -impl __sdk::InModule for InsertCallerPkAddress { +impl From for super::Reducer { + fn from(args: InsertCallerPkAddressArgs) -> Self { + Self::InsertCallerPkAddress { data: args.data } + } +} + +impl __sdk::InModule for InsertCallerPkAddressArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_caller_pk_address { impl insert_caller_pk_address for super::RemoteReducers { fn insert_caller_pk_address(&self, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_pk_address", InsertCallerPkAddress { data }) + .call_reducer("insert_caller_pk_address", InsertCallerPkAddressArgs { data }) } fn on_insert_caller_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerPkAddressCallbackId { - InsertCallerPkAddressCallbackId(self.imp.on_reducer::( + InsertCallerPkAddressCallbackId(self.imp.on_reducer( "insert_caller_pk_address", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerPkAddress| callback(ctx, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerPkAddress { data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, data) + }), )) } fn remove_on_insert_caller_pk_address(&self, callback: InsertCallerPkAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_pk_address", callback.0) + self.imp.remove_on_reducer("insert_caller_pk_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs index 85827b26f0..cb01efde17 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerPkIdentity { +pub(super) struct InsertCallerPkIdentityArgs { pub data: i32, } -impl __sdk::InModule for InsertCallerPkIdentity { +impl From for super::Reducer { + fn from(args: InsertCallerPkIdentityArgs) -> Self { + Self::InsertCallerPkIdentity { data: args.data } + } +} + +impl __sdk::InModule for InsertCallerPkIdentityArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_caller_pk_identity { impl insert_caller_pk_identity for super::RemoteReducers { fn insert_caller_pk_identity(&self, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_pk_identity", InsertCallerPkIdentity { data }) + .call_reducer("insert_caller_pk_identity", InsertCallerPkIdentityArgs { data }) } fn on_insert_caller_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerPkIdentityCallbackId { - InsertCallerPkIdentityCallbackId(self.imp.on_reducer::( + InsertCallerPkIdentityCallbackId(self.imp.on_reducer( "insert_caller_pk_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerPkIdentity| callback(ctx, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerPkIdentity { data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, data) + }), )) } fn remove_on_insert_caller_pk_identity(&self, callback: InsertCallerPkIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_pk_identity", callback.0) + self.imp.remove_on_reducer("insert_caller_pk_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs index 2073f6f4f5..af19b55d52 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerUniqueAddress { +pub(super) struct InsertCallerUniqueAddressArgs { pub data: i32, } -impl __sdk::InModule for InsertCallerUniqueAddress { +impl From for super::Reducer { + fn from(args: InsertCallerUniqueAddressArgs) -> Self { + Self::InsertCallerUniqueAddress { data: args.data } + } +} + +impl __sdk::InModule for InsertCallerUniqueAddressArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_caller_unique_address { impl insert_caller_unique_address for super::RemoteReducers { fn insert_caller_unique_address(&self, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_unique_address", InsertCallerUniqueAddress { data }) + .call_reducer("insert_caller_unique_address", InsertCallerUniqueAddressArgs { data }) } fn on_insert_caller_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerUniqueAddressCallbackId { - InsertCallerUniqueAddressCallbackId(self.imp.on_reducer::( + InsertCallerUniqueAddressCallbackId(self.imp.on_reducer( "insert_caller_unique_address", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerUniqueAddress| callback(ctx, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerUniqueAddress { data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, data) + }), )) } fn remove_on_insert_caller_unique_address(&self, callback: InsertCallerUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_unique_address", callback.0) + self.imp.remove_on_reducer("insert_caller_unique_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs index bde58d11e1..dd0631421d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerUniqueIdentity { +pub(super) struct InsertCallerUniqueIdentityArgs { pub data: i32, } -impl __sdk::InModule for InsertCallerUniqueIdentity { +impl From for super::Reducer { + fn from(args: InsertCallerUniqueIdentityArgs) -> Self { + Self::InsertCallerUniqueIdentity { data: args.data } + } +} + +impl __sdk::InModule for InsertCallerUniqueIdentityArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_caller_unique_identity { impl insert_caller_unique_identity for super::RemoteReducers { fn insert_caller_unique_identity(&self, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_unique_identity", InsertCallerUniqueIdentity { data }) + .call_reducer("insert_caller_unique_identity", InsertCallerUniqueIdentityArgs { data }) } fn on_insert_caller_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerUniqueIdentityCallbackId { - InsertCallerUniqueIdentityCallbackId(self.imp.on_reducer::( + InsertCallerUniqueIdentityCallbackId(self.imp.on_reducer( "insert_caller_unique_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerUniqueIdentity| callback(ctx, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerUniqueIdentity { data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, data) + }), )) } fn remove_on_insert_caller_unique_identity(&self, callback: InsertCallerUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_unique_identity", callback.0) + self.imp.remove_on_reducer("insert_caller_unique_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs index cca241a9f5..ca065f2621 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerVecAddress {} +pub(super) struct InsertCallerVecAddressArgs {} -impl __sdk::InModule for InsertCallerVecAddress { +impl From for super::Reducer { + fn from(args: InsertCallerVecAddressArgs) -> Self { + Self::InsertCallerVecAddress + } +} + +impl __sdk::InModule for InsertCallerVecAddressArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait insert_caller_vec_address { impl insert_caller_vec_address for super::RemoteReducers { fn insert_caller_vec_address(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_vec_address", InsertCallerVecAddress {}) + .call_reducer("insert_caller_vec_address", InsertCallerVecAddressArgs {}) } fn on_insert_caller_vec_address( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerVecAddressCallbackId { - InsertCallerVecAddressCallbackId(self.imp.on_reducer::( + InsertCallerVecAddressCallbackId(self.imp.on_reducer( "insert_caller_vec_address", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerVecAddress| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerVecAddress {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_insert_caller_vec_address(&self, callback: InsertCallerVecAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_vec_address", callback.0) + self.imp.remove_on_reducer("insert_caller_vec_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs index ef7f184c09..5632e86775 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertCallerVecIdentity {} +pub(super) struct InsertCallerVecIdentityArgs {} -impl __sdk::InModule for InsertCallerVecIdentity { +impl From for super::Reducer { + fn from(args: InsertCallerVecIdentityArgs) -> Self { + Self::InsertCallerVecIdentity + } +} + +impl __sdk::InModule for InsertCallerVecIdentityArgs { type Module = super::RemoteModule; } @@ -50,20 +56,32 @@ pub trait insert_caller_vec_identity { impl insert_caller_vec_identity for super::RemoteReducers { fn insert_caller_vec_identity(&self) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_caller_vec_identity", InsertCallerVecIdentity {}) + .call_reducer("insert_caller_vec_identity", InsertCallerVecIdentityArgs {}) } fn on_insert_caller_vec_identity( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerVecIdentityCallbackId { - InsertCallerVecIdentityCallbackId(self.imp.on_reducer::( + InsertCallerVecIdentityCallbackId(self.imp.on_reducer( "insert_caller_vec_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertCallerVecIdentity| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertCallerVecIdentity {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_insert_caller_vec_identity(&self, callback: InsertCallerVecIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_vec_identity", callback.0) + self.imp.remove_on_reducer("insert_caller_vec_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs index eaca1e5100..8344dabaf9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs @@ -16,7 +16,7 @@ use super::unit_struct_type::UnitStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertLargeTable { +pub(super) struct InsertLargeTableArgs { pub a: u8, pub b: u16, pub c: u32, @@ -41,7 +41,36 @@ pub struct InsertLargeTable { pub v: EveryVecStruct, } -impl __sdk::InModule for InsertLargeTable { +impl From for super::Reducer { + fn from(args: InsertLargeTableArgs) -> Self { + Self::InsertLargeTable { + a: args.a, + b: args.b, + c: args.c, + d: args.d, + e: args.e, + f: args.f, + g: args.g, + h: args.h, + i: args.i, + j: args.j, + k: args.k, + l: args.l, + m: args.m, + n: args.n, + o: args.o, + p: args.p, + q: args.q, + r: args.r, + s: args.s, + t: args.t, + u: args.u, + v: args.v, + } + } +} + +impl __sdk::InModule for InsertLargeTableArgs { type Module = super::RemoteModule; } @@ -154,7 +183,7 @@ impl insert_large_table for super::RemoteReducers { ) -> __anyhow::Result<()> { self.imp.call_reducer( "insert_large_table", - InsertLargeTable { + InsertLargeTableArgs { a, b, c, @@ -209,20 +238,50 @@ impl insert_large_table for super::RemoteReducers { ) + Send + 'static, ) -> InsertLargeTableCallbackId { - InsertLargeTableCallbackId(self.imp.on_reducer::( + InsertLargeTableCallbackId(self.imp.on_reducer( "insert_large_table", - Box::new(move |ctx: &super::EventContext, args: &InsertLargeTable| { - callback( - ctx, &args.a, &args.b, &args.c, &args.d, &args.e, &args.f, &args.g, &args.h, &args.i, &args.j, - &args.k, &args.l, &args.m, &args.n, &args.o, &args.p, &args.q, &args.r, &args.s, &args.t, &args.u, - &args.v, - ) + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: + super::Reducer::InsertLargeTable { + a, + b, + c, + d, + e, + f, + g, + h, + i, + j, + k, + l, + m, + n, + o, + p, + q, + r, + s, + t, + u, + v, + }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) }), )) } fn remove_on_insert_large_table(&self, callback: InsertLargeTableCallbackId) { - self.imp - .remove_on_reducer::("insert_large_table", callback.0) + self.imp.remove_on_reducer("insert_large_table", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs index f396e3adce..0b6ea59567 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneAddress { +pub(super) struct InsertOneAddressArgs { pub a: __sdk::Address, } -impl __sdk::InModule for InsertOneAddress { +impl From for super::Reducer { + fn from(args: InsertOneAddressArgs) -> Self { + Self::InsertOneAddress { a: args.a } + } +} + +impl __sdk::InModule for InsertOneAddressArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_address { impl insert_one_address for super::RemoteReducers { fn insert_one_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_address", InsertOneAddress { a }) + self.imp.call_reducer("insert_one_address", InsertOneAddressArgs { a }) } fn on_insert_one_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> InsertOneAddressCallbackId { - InsertOneAddressCallbackId(self.imp.on_reducer::( + InsertOneAddressCallbackId(self.imp.on_reducer( "insert_one_address", - Box::new(move |ctx: &super::EventContext, args: &InsertOneAddress| callback(ctx, &args.a)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneAddress { a }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a) + }), )) } fn remove_on_insert_one_address(&self, callback: InsertOneAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_one_address", callback.0) + self.imp.remove_on_reducer("insert_one_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs index df2498ba53..7dc9537951 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneBool { +pub(super) struct InsertOneBoolArgs { pub b: bool, } -impl __sdk::InModule for InsertOneBool { +impl From for super::Reducer { + fn from(args: InsertOneBoolArgs) -> Self { + Self::InsertOneBool { b: args.b } + } +} + +impl __sdk::InModule for InsertOneBoolArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_bool { impl insert_one_bool for super::RemoteReducers { fn insert_one_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_bool", InsertOneBool { b }) + self.imp.call_reducer("insert_one_bool", InsertOneBoolArgs { b }) } fn on_insert_one_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> InsertOneBoolCallbackId { - InsertOneBoolCallbackId(self.imp.on_reducer::( + InsertOneBoolCallbackId(self.imp.on_reducer( "insert_one_bool", - Box::new(move |ctx: &super::EventContext, args: &InsertOneBool| callback(ctx, &args.b)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneBool { b }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b) + }), )) } fn remove_on_insert_one_bool(&self, callback: InsertOneBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_one_bool", callback.0) + self.imp.remove_on_reducer("insert_one_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs index 79aa31d40d..95fa6daf16 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs @@ -11,11 +11,17 @@ use super::byte_struct_type::ByteStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneByteStruct { +pub(super) struct InsertOneByteStructArgs { pub s: ByteStruct, } -impl __sdk::InModule for InsertOneByteStruct { +impl From for super::Reducer { + fn from(args: InsertOneByteStructArgs) -> Self { + Self::InsertOneByteStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertOneByteStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_one_byte_struct { impl insert_one_byte_struct for super::RemoteReducers { fn insert_one_byte_struct(&self, s: ByteStruct) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_one_byte_struct", InsertOneByteStruct { s }) + .call_reducer("insert_one_byte_struct", InsertOneByteStructArgs { s }) } fn on_insert_one_byte_struct( &self, mut callback: impl FnMut(&super::EventContext, &ByteStruct) + Send + 'static, ) -> InsertOneByteStructCallbackId { - InsertOneByteStructCallbackId(self.imp.on_reducer::( + InsertOneByteStructCallbackId(self.imp.on_reducer( "insert_one_byte_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertOneByteStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneByteStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_one_byte_struct(&self, callback: InsertOneByteStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_byte_struct", callback.0) + self.imp.remove_on_reducer("insert_one_byte_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs index 55f7cf2f28..2ff5a054ea 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs @@ -11,11 +11,17 @@ use super::enum_with_payload_type::EnumWithPayload; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneEnumWithPayload { +pub(super) struct InsertOneEnumWithPayloadArgs { pub e: EnumWithPayload, } -impl __sdk::InModule for InsertOneEnumWithPayload { +impl From for super::Reducer { + fn from(args: InsertOneEnumWithPayloadArgs) -> Self { + Self::InsertOneEnumWithPayload { e: args.e } + } +} + +impl __sdk::InModule for InsertOneEnumWithPayloadArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_one_enum_with_payload { impl insert_one_enum_with_payload for super::RemoteReducers { fn insert_one_enum_with_payload(&self, e: EnumWithPayload) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_one_enum_with_payload", InsertOneEnumWithPayload { e }) + .call_reducer("insert_one_enum_with_payload", InsertOneEnumWithPayloadArgs { e }) } fn on_insert_one_enum_with_payload( &self, mut callback: impl FnMut(&super::EventContext, &EnumWithPayload) + Send + 'static, ) -> InsertOneEnumWithPayloadCallbackId { - InsertOneEnumWithPayloadCallbackId(self.imp.on_reducer::( + InsertOneEnumWithPayloadCallbackId(self.imp.on_reducer( "insert_one_enum_with_payload", - Box::new(move |ctx: &super::EventContext, args: &InsertOneEnumWithPayload| callback(ctx, &args.e)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneEnumWithPayload { e }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, e) + }), )) } fn remove_on_insert_one_enum_with_payload(&self, callback: InsertOneEnumWithPayloadCallbackId) { - self.imp - .remove_on_reducer::("insert_one_enum_with_payload", callback.0) + self.imp.remove_on_reducer("insert_one_enum_with_payload", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs index 9bc335a509..d59c4712a2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs @@ -11,11 +11,17 @@ use super::every_primitive_struct_type::EveryPrimitiveStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneEveryPrimitiveStruct { +pub(super) struct InsertOneEveryPrimitiveStructArgs { pub s: EveryPrimitiveStruct, } -impl __sdk::InModule for InsertOneEveryPrimitiveStruct { +impl From for super::Reducer { + fn from(args: InsertOneEveryPrimitiveStructArgs) -> Self { + Self::InsertOneEveryPrimitiveStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertOneEveryPrimitiveStructArgs { type Module = super::RemoteModule; } @@ -53,21 +59,36 @@ pub trait insert_one_every_primitive_struct { impl insert_one_every_primitive_struct for super::RemoteReducers { fn insert_one_every_primitive_struct(&self, s: EveryPrimitiveStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_every_primitive_struct", InsertOneEveryPrimitiveStruct { s }) + self.imp.call_reducer( + "insert_one_every_primitive_struct", + InsertOneEveryPrimitiveStructArgs { s }, + ) } fn on_insert_one_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &EveryPrimitiveStruct) + Send + 'static, ) -> InsertOneEveryPrimitiveStructCallbackId { - InsertOneEveryPrimitiveStructCallbackId(self.imp.on_reducer::( + InsertOneEveryPrimitiveStructCallbackId(self.imp.on_reducer( "insert_one_every_primitive_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertOneEveryPrimitiveStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneEveryPrimitiveStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_one_every_primitive_struct(&self, callback: InsertOneEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_one_every_primitive_struct", callback.0) + .remove_on_reducer("insert_one_every_primitive_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs index 29a7239485..a42943b15a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs @@ -11,11 +11,17 @@ use super::every_vec_struct_type::EveryVecStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneEveryVecStruct { +pub(super) struct InsertOneEveryVecStructArgs { pub s: EveryVecStruct, } -impl __sdk::InModule for InsertOneEveryVecStruct { +impl From for super::Reducer { + fn from(args: InsertOneEveryVecStructArgs) -> Self { + Self::InsertOneEveryVecStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertOneEveryVecStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_one_every_vec_struct { impl insert_one_every_vec_struct for super::RemoteReducers { fn insert_one_every_vec_struct(&self, s: EveryVecStruct) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_one_every_vec_struct", InsertOneEveryVecStruct { s }) + .call_reducer("insert_one_every_vec_struct", InsertOneEveryVecStructArgs { s }) } fn on_insert_one_every_vec_struct( &self, mut callback: impl FnMut(&super::EventContext, &EveryVecStruct) + Send + 'static, ) -> InsertOneEveryVecStructCallbackId { - InsertOneEveryVecStructCallbackId(self.imp.on_reducer::( + InsertOneEveryVecStructCallbackId(self.imp.on_reducer( "insert_one_every_vec_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertOneEveryVecStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneEveryVecStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_one_every_vec_struct(&self, callback: InsertOneEveryVecStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_every_vec_struct", callback.0) + self.imp.remove_on_reducer("insert_one_every_vec_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs index 2f0413d795..db81c7680f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneF32 { +pub(super) struct InsertOneF32Args { pub f: f32, } -impl __sdk::InModule for InsertOneF32 { +impl From for super::Reducer { + fn from(args: InsertOneF32Args) -> Self { + Self::InsertOneF32 { f: args.f } + } +} + +impl __sdk::InModule for InsertOneF32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_f_32 { impl insert_one_f_32 for super::RemoteReducers { fn insert_one_f_32(&self, f: f32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_f32", InsertOneF32 { f }) + self.imp.call_reducer("insert_one_f32", InsertOneF32Args { f }) } fn on_insert_one_f_32( &self, mut callback: impl FnMut(&super::EventContext, &f32) + Send + 'static, ) -> InsertOneF32CallbackId { - InsertOneF32CallbackId(self.imp.on_reducer::( + InsertOneF32CallbackId(self.imp.on_reducer( "insert_one_f32", - Box::new(move |ctx: &super::EventContext, args: &InsertOneF32| callback(ctx, &args.f)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneF32 { f }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, f) + }), )) } fn remove_on_insert_one_f_32(&self, callback: InsertOneF32CallbackId) { - self.imp.remove_on_reducer::("insert_one_f32", callback.0) + self.imp.remove_on_reducer("insert_one_f32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs index 36da51df8c..9f55c024af 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneF64 { +pub(super) struct InsertOneF64Args { pub f: f64, } -impl __sdk::InModule for InsertOneF64 { +impl From for super::Reducer { + fn from(args: InsertOneF64Args) -> Self { + Self::InsertOneF64 { f: args.f } + } +} + +impl __sdk::InModule for InsertOneF64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_f_64 { impl insert_one_f_64 for super::RemoteReducers { fn insert_one_f_64(&self, f: f64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_f64", InsertOneF64 { f }) + self.imp.call_reducer("insert_one_f64", InsertOneF64Args { f }) } fn on_insert_one_f_64( &self, mut callback: impl FnMut(&super::EventContext, &f64) + Send + 'static, ) -> InsertOneF64CallbackId { - InsertOneF64CallbackId(self.imp.on_reducer::( + InsertOneF64CallbackId(self.imp.on_reducer( "insert_one_f64", - Box::new(move |ctx: &super::EventContext, args: &InsertOneF64| callback(ctx, &args.f)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneF64 { f }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, f) + }), )) } fn remove_on_insert_one_f_64(&self, callback: InsertOneF64CallbackId) { - self.imp.remove_on_reducer::("insert_one_f64", callback.0) + self.imp.remove_on_reducer("insert_one_f64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs index 2e15665607..5a0838c637 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI128 { +pub(super) struct InsertOneI128Args { pub n: i128, } -impl __sdk::InModule for InsertOneI128 { +impl From for super::Reducer { + fn from(args: InsertOneI128Args) -> Self { + Self::InsertOneI128 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_i_128 { impl insert_one_i_128 for super::RemoteReducers { fn insert_one_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i128", InsertOneI128 { n }) + self.imp.call_reducer("insert_one_i128", InsertOneI128Args { n }) } fn on_insert_one_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> InsertOneI128CallbackId { - InsertOneI128CallbackId(self.imp.on_reducer::( + InsertOneI128CallbackId(self.imp.on_reducer( "insert_one_i128", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_128(&self, callback: InsertOneI128CallbackId) { - self.imp - .remove_on_reducer::("insert_one_i128", callback.0) + self.imp.remove_on_reducer("insert_one_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs index 80cd4cc916..17da31961b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI16 { +pub(super) struct InsertOneI16Args { pub n: i16, } -impl __sdk::InModule for InsertOneI16 { +impl From for super::Reducer { + fn from(args: InsertOneI16Args) -> Self { + Self::InsertOneI16 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_i_16 { impl insert_one_i_16 for super::RemoteReducers { fn insert_one_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i16", InsertOneI16 { n }) + self.imp.call_reducer("insert_one_i16", InsertOneI16Args { n }) } fn on_insert_one_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> InsertOneI16CallbackId { - InsertOneI16CallbackId(self.imp.on_reducer::( + InsertOneI16CallbackId(self.imp.on_reducer( "insert_one_i16", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_16(&self, callback: InsertOneI16CallbackId) { - self.imp.remove_on_reducer::("insert_one_i16", callback.0) + self.imp.remove_on_reducer("insert_one_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs index d1f9091f8d..877858eb0b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI256 { +pub(super) struct InsertOneI256Args { pub n: __sats::i256, } -impl __sdk::InModule for InsertOneI256 { +impl From for super::Reducer { + fn from(args: InsertOneI256Args) -> Self { + Self::InsertOneI256 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_i_256 { impl insert_one_i_256 for super::RemoteReducers { fn insert_one_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i256", InsertOneI256 { n }) + self.imp.call_reducer("insert_one_i256", InsertOneI256Args { n }) } fn on_insert_one_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> InsertOneI256CallbackId { - InsertOneI256CallbackId(self.imp.on_reducer::( + InsertOneI256CallbackId(self.imp.on_reducer( "insert_one_i256", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_256(&self, callback: InsertOneI256CallbackId) { - self.imp - .remove_on_reducer::("insert_one_i256", callback.0) + self.imp.remove_on_reducer("insert_one_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs index d048181f83..12ddc0eb4e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI32 { +pub(super) struct InsertOneI32Args { pub n: i32, } -impl __sdk::InModule for InsertOneI32 { +impl From for super::Reducer { + fn from(args: InsertOneI32Args) -> Self { + Self::InsertOneI32 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_i_32 { impl insert_one_i_32 for super::RemoteReducers { fn insert_one_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i32", InsertOneI32 { n }) + self.imp.call_reducer("insert_one_i32", InsertOneI32Args { n }) } fn on_insert_one_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertOneI32CallbackId { - InsertOneI32CallbackId(self.imp.on_reducer::( + InsertOneI32CallbackId(self.imp.on_reducer( "insert_one_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_32(&self, callback: InsertOneI32CallbackId) { - self.imp.remove_on_reducer::("insert_one_i32", callback.0) + self.imp.remove_on_reducer("insert_one_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs index 774ac5fcf5..61e4866d99 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI64 { +pub(super) struct InsertOneI64Args { pub n: i64, } -impl __sdk::InModule for InsertOneI64 { +impl From for super::Reducer { + fn from(args: InsertOneI64Args) -> Self { + Self::InsertOneI64 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_i_64 { impl insert_one_i_64 for super::RemoteReducers { fn insert_one_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i64", InsertOneI64 { n }) + self.imp.call_reducer("insert_one_i64", InsertOneI64Args { n }) } fn on_insert_one_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> InsertOneI64CallbackId { - InsertOneI64CallbackId(self.imp.on_reducer::( + InsertOneI64CallbackId(self.imp.on_reducer( "insert_one_i64", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_64(&self, callback: InsertOneI64CallbackId) { - self.imp.remove_on_reducer::("insert_one_i64", callback.0) + self.imp.remove_on_reducer("insert_one_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs index 46ada01498..7dab4a8108 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneI8 { +pub(super) struct InsertOneI8Args { pub n: i8, } -impl __sdk::InModule for InsertOneI8 { +impl From for super::Reducer { + fn from(args: InsertOneI8Args) -> Self { + Self::InsertOneI8 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneI8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_i_8 { impl insert_one_i_8 for super::RemoteReducers { fn insert_one_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i8", InsertOneI8 { n }) + self.imp.call_reducer("insert_one_i8", InsertOneI8Args { n }) } fn on_insert_one_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> InsertOneI8CallbackId { - InsertOneI8CallbackId(self.imp.on_reducer::( + InsertOneI8CallbackId(self.imp.on_reducer( "insert_one_i8", - Box::new(move |ctx: &super::EventContext, args: &InsertOneI8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneI8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_i_8(&self, callback: InsertOneI8CallbackId) { - self.imp.remove_on_reducer::("insert_one_i8", callback.0) + self.imp.remove_on_reducer("insert_one_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs index dd849c1ed9..8b155949d2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneIdentity { +pub(super) struct InsertOneIdentityArgs { pub i: __sdk::Identity, } -impl __sdk::InModule for InsertOneIdentity { +impl From for super::Reducer { + fn from(args: InsertOneIdentityArgs) -> Self { + Self::InsertOneIdentity { i: args.i } + } +} + +impl __sdk::InModule for InsertOneIdentityArgs { type Module = super::RemoteModule; } @@ -51,20 +57,33 @@ pub trait insert_one_identity { impl insert_one_identity for super::RemoteReducers { fn insert_one_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_identity", InsertOneIdentity { i }) + self.imp + .call_reducer("insert_one_identity", InsertOneIdentityArgs { i }) } fn on_insert_one_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> InsertOneIdentityCallbackId { - InsertOneIdentityCallbackId(self.imp.on_reducer::( + InsertOneIdentityCallbackId(self.imp.on_reducer( "insert_one_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertOneIdentity| callback(ctx, &args.i)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneIdentity { i }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i) + }), )) } fn remove_on_insert_one_identity(&self, callback: InsertOneIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_one_identity", callback.0) + self.imp.remove_on_reducer("insert_one_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs index 781f92bc62..424f723d29 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs @@ -11,11 +11,17 @@ use super::simple_enum_type::SimpleEnum; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneSimpleEnum { +pub(super) struct InsertOneSimpleEnumArgs { pub e: SimpleEnum, } -impl __sdk::InModule for InsertOneSimpleEnum { +impl From for super::Reducer { + fn from(args: InsertOneSimpleEnumArgs) -> Self { + Self::InsertOneSimpleEnum { e: args.e } + } +} + +impl __sdk::InModule for InsertOneSimpleEnumArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_one_simple_enum { impl insert_one_simple_enum for super::RemoteReducers { fn insert_one_simple_enum(&self, e: SimpleEnum) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_one_simple_enum", InsertOneSimpleEnum { e }) + .call_reducer("insert_one_simple_enum", InsertOneSimpleEnumArgs { e }) } fn on_insert_one_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &SimpleEnum) + Send + 'static, ) -> InsertOneSimpleEnumCallbackId { - InsertOneSimpleEnumCallbackId(self.imp.on_reducer::( + InsertOneSimpleEnumCallbackId(self.imp.on_reducer( "insert_one_simple_enum", - Box::new(move |ctx: &super::EventContext, args: &InsertOneSimpleEnum| callback(ctx, &args.e)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneSimpleEnum { e }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, e) + }), )) } fn remove_on_insert_one_simple_enum(&self, callback: InsertOneSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_one_simple_enum", callback.0) + self.imp.remove_on_reducer("insert_one_simple_enum", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs index 06b9e1610d..76fd9fead6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneString { +pub(super) struct InsertOneStringArgs { pub s: String, } -impl __sdk::InModule for InsertOneString { +impl From for super::Reducer { + fn from(args: InsertOneStringArgs) -> Self { + Self::InsertOneString { s: args.s } + } +} + +impl __sdk::InModule for InsertOneStringArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_string { impl insert_one_string for super::RemoteReducers { fn insert_one_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_string", InsertOneString { s }) + self.imp.call_reducer("insert_one_string", InsertOneStringArgs { s }) } fn on_insert_one_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> InsertOneStringCallbackId { - InsertOneStringCallbackId(self.imp.on_reducer::( + InsertOneStringCallbackId(self.imp.on_reducer( "insert_one_string", - Box::new(move |ctx: &super::EventContext, args: &InsertOneString| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneString { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_one_string(&self, callback: InsertOneStringCallbackId) { - self.imp - .remove_on_reducer::("insert_one_string", callback.0) + self.imp.remove_on_reducer("insert_one_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs index d2fd61c73d..c7dd6695b8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU128 { +pub(super) struct InsertOneU128Args { pub n: u128, } -impl __sdk::InModule for InsertOneU128 { +impl From for super::Reducer { + fn from(args: InsertOneU128Args) -> Self { + Self::InsertOneU128 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_u_128 { impl insert_one_u_128 for super::RemoteReducers { fn insert_one_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u128", InsertOneU128 { n }) + self.imp.call_reducer("insert_one_u128", InsertOneU128Args { n }) } fn on_insert_one_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> InsertOneU128CallbackId { - InsertOneU128CallbackId(self.imp.on_reducer::( + InsertOneU128CallbackId(self.imp.on_reducer( "insert_one_u128", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_128(&self, callback: InsertOneU128CallbackId) { - self.imp - .remove_on_reducer::("insert_one_u128", callback.0) + self.imp.remove_on_reducer("insert_one_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs index e10af7a78f..751072cdae 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU16 { +pub(super) struct InsertOneU16Args { pub n: u16, } -impl __sdk::InModule for InsertOneU16 { +impl From for super::Reducer { + fn from(args: InsertOneU16Args) -> Self { + Self::InsertOneU16 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_u_16 { impl insert_one_u_16 for super::RemoteReducers { fn insert_one_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u16", InsertOneU16 { n }) + self.imp.call_reducer("insert_one_u16", InsertOneU16Args { n }) } fn on_insert_one_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> InsertOneU16CallbackId { - InsertOneU16CallbackId(self.imp.on_reducer::( + InsertOneU16CallbackId(self.imp.on_reducer( "insert_one_u16", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_16(&self, callback: InsertOneU16CallbackId) { - self.imp.remove_on_reducer::("insert_one_u16", callback.0) + self.imp.remove_on_reducer("insert_one_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs index eba92a2b13..7064582d84 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU256 { +pub(super) struct InsertOneU256Args { pub n: __sats::u256, } -impl __sdk::InModule for InsertOneU256 { +impl From for super::Reducer { + fn from(args: InsertOneU256Args) -> Self { + Self::InsertOneU256 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_one_u_256 { impl insert_one_u_256 for super::RemoteReducers { fn insert_one_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u256", InsertOneU256 { n }) + self.imp.call_reducer("insert_one_u256", InsertOneU256Args { n }) } fn on_insert_one_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> InsertOneU256CallbackId { - InsertOneU256CallbackId(self.imp.on_reducer::( + InsertOneU256CallbackId(self.imp.on_reducer( "insert_one_u256", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_256(&self, callback: InsertOneU256CallbackId) { - self.imp - .remove_on_reducer::("insert_one_u256", callback.0) + self.imp.remove_on_reducer("insert_one_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs index e55b85003d..56ffadc531 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU32 { +pub(super) struct InsertOneU32Args { pub n: u32, } -impl __sdk::InModule for InsertOneU32 { +impl From for super::Reducer { + fn from(args: InsertOneU32Args) -> Self { + Self::InsertOneU32 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_u_32 { impl insert_one_u_32 for super::RemoteReducers { fn insert_one_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u32", InsertOneU32 { n }) + self.imp.call_reducer("insert_one_u32", InsertOneU32Args { n }) } fn on_insert_one_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> InsertOneU32CallbackId { - InsertOneU32CallbackId(self.imp.on_reducer::( + InsertOneU32CallbackId(self.imp.on_reducer( "insert_one_u32", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_32(&self, callback: InsertOneU32CallbackId) { - self.imp.remove_on_reducer::("insert_one_u32", callback.0) + self.imp.remove_on_reducer("insert_one_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs index b8b9ed2074..029c64eaee 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU64 { +pub(super) struct InsertOneU64Args { pub n: u64, } -impl __sdk::InModule for InsertOneU64 { +impl From for super::Reducer { + fn from(args: InsertOneU64Args) -> Self { + Self::InsertOneU64 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_u_64 { impl insert_one_u_64 for super::RemoteReducers { fn insert_one_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u64", InsertOneU64 { n }) + self.imp.call_reducer("insert_one_u64", InsertOneU64Args { n }) } fn on_insert_one_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> InsertOneU64CallbackId { - InsertOneU64CallbackId(self.imp.on_reducer::( + InsertOneU64CallbackId(self.imp.on_reducer( "insert_one_u64", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_64(&self, callback: InsertOneU64CallbackId) { - self.imp.remove_on_reducer::("insert_one_u64", callback.0) + self.imp.remove_on_reducer("insert_one_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs index 8e63411f99..f11c7df20f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneU8 { +pub(super) struct InsertOneU8Args { pub n: u8, } -impl __sdk::InModule for InsertOneU8 { +impl From for super::Reducer { + fn from(args: InsertOneU8Args) -> Self { + Self::InsertOneU8 { n: args.n } + } +} + +impl __sdk::InModule for InsertOneU8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_one_u_8 { impl insert_one_u_8 for super::RemoteReducers { fn insert_one_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u8", InsertOneU8 { n }) + self.imp.call_reducer("insert_one_u8", InsertOneU8Args { n }) } fn on_insert_one_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> InsertOneU8CallbackId { - InsertOneU8CallbackId(self.imp.on_reducer::( + InsertOneU8CallbackId(self.imp.on_reducer( "insert_one_u8", - Box::new(move |ctx: &super::EventContext, args: &InsertOneU8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneU8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_one_u_8(&self, callback: InsertOneU8CallbackId) { - self.imp.remove_on_reducer::("insert_one_u8", callback.0) + self.imp.remove_on_reducer("insert_one_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs index 9c59d9cdea..3dd290d8ba 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs @@ -11,11 +11,17 @@ use super::unit_struct_type::UnitStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOneUnitStruct { +pub(super) struct InsertOneUnitStructArgs { pub s: UnitStruct, } -impl __sdk::InModule for InsertOneUnitStruct { +impl From for super::Reducer { + fn from(args: InsertOneUnitStructArgs) -> Self { + Self::InsertOneUnitStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertOneUnitStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_one_unit_struct { impl insert_one_unit_struct for super::RemoteReducers { fn insert_one_unit_struct(&self, s: UnitStruct) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_one_unit_struct", InsertOneUnitStruct { s }) + .call_reducer("insert_one_unit_struct", InsertOneUnitStructArgs { s }) } fn on_insert_one_unit_struct( &self, mut callback: impl FnMut(&super::EventContext, &UnitStruct) + Send + 'static, ) -> InsertOneUnitStructCallbackId { - InsertOneUnitStructCallbackId(self.imp.on_reducer::( + InsertOneUnitStructCallbackId(self.imp.on_reducer( "insert_one_unit_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertOneUnitStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOneUnitStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_one_unit_struct(&self, callback: InsertOneUnitStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_unit_struct", callback.0) + self.imp.remove_on_reducer("insert_one_unit_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs index f3f3786dde..bbb164eb06 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs @@ -11,11 +11,17 @@ use super::every_primitive_struct_type::EveryPrimitiveStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionEveryPrimitiveStruct { +pub(super) struct InsertOptionEveryPrimitiveStructArgs { pub s: Option, } -impl __sdk::InModule for InsertOptionEveryPrimitiveStruct { +impl From for super::Reducer { + fn from(args: InsertOptionEveryPrimitiveStructArgs) -> Self { + Self::InsertOptionEveryPrimitiveStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertOptionEveryPrimitiveStructArgs { type Module = super::RemoteModule; } @@ -55,21 +61,34 @@ impl insert_option_every_primitive_struct for super::RemoteReducers { fn insert_option_every_primitive_struct(&self, s: Option) -> __anyhow::Result<()> { self.imp.call_reducer( "insert_option_every_primitive_struct", - InsertOptionEveryPrimitiveStruct { s }, + InsertOptionEveryPrimitiveStructArgs { s }, ) } fn on_insert_option_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionEveryPrimitiveStructCallbackId { - InsertOptionEveryPrimitiveStructCallbackId(self.imp.on_reducer::( + InsertOptionEveryPrimitiveStructCallbackId(self.imp.on_reducer( "insert_option_every_primitive_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionEveryPrimitiveStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionEveryPrimitiveStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_option_every_primitive_struct(&self, callback: InsertOptionEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_option_every_primitive_struct", callback.0) + .remove_on_reducer("insert_option_every_primitive_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs index 16f249ba48..e0ecce5a2a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionI32 { +pub(super) struct InsertOptionI32Args { pub n: Option, } -impl __sdk::InModule for InsertOptionI32 { +impl From for super::Reducer { + fn from(args: InsertOptionI32Args) -> Self { + Self::InsertOptionI32 { n: args.n } + } +} + +impl __sdk::InModule for InsertOptionI32Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_option_i_32 { impl insert_option_i_32 for super::RemoteReducers { fn insert_option_i_32(&self, n: Option) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_option_i32", InsertOptionI32 { n }) + self.imp.call_reducer("insert_option_i32", InsertOptionI32Args { n }) } fn on_insert_option_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionI32CallbackId { - InsertOptionI32CallbackId(self.imp.on_reducer::( + InsertOptionI32CallbackId(self.imp.on_reducer( "insert_option_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionI32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionI32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_option_i_32(&self, callback: InsertOptionI32CallbackId) { - self.imp - .remove_on_reducer::("insert_option_i32", callback.0) + self.imp.remove_on_reducer("insert_option_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs index 9f4791f0e2..0b6c4e4a8b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionIdentity { +pub(super) struct InsertOptionIdentityArgs { pub i: Option<__sdk::Identity>, } -impl __sdk::InModule for InsertOptionIdentity { +impl From for super::Reducer { + fn from(args: InsertOptionIdentityArgs) -> Self { + Self::InsertOptionIdentity { i: args.i } + } +} + +impl __sdk::InModule for InsertOptionIdentityArgs { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_option_identity { impl insert_option_identity for super::RemoteReducers { fn insert_option_identity(&self, i: Option<__sdk::Identity>) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_option_identity", InsertOptionIdentity { i }) + .call_reducer("insert_option_identity", InsertOptionIdentityArgs { i }) } fn on_insert_option_identity( &self, mut callback: impl FnMut(&super::EventContext, &Option<__sdk::Identity>) + Send + 'static, ) -> InsertOptionIdentityCallbackId { - InsertOptionIdentityCallbackId(self.imp.on_reducer::( + InsertOptionIdentityCallbackId(self.imp.on_reducer( "insert_option_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionIdentity| callback(ctx, &args.i)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionIdentity { i }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i) + }), )) } fn remove_on_insert_option_identity(&self, callback: InsertOptionIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_option_identity", callback.0) + self.imp.remove_on_reducer("insert_option_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs index b41ac61ff4..37e17334e8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs @@ -11,11 +11,17 @@ use super::simple_enum_type::SimpleEnum; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionSimpleEnum { +pub(super) struct InsertOptionSimpleEnumArgs { pub e: Option, } -impl __sdk::InModule for InsertOptionSimpleEnum { +impl From for super::Reducer { + fn from(args: InsertOptionSimpleEnumArgs) -> Self { + Self::InsertOptionSimpleEnum { e: args.e } + } +} + +impl __sdk::InModule for InsertOptionSimpleEnumArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_option_simple_enum { impl insert_option_simple_enum for super::RemoteReducers { fn insert_option_simple_enum(&self, e: Option) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_option_simple_enum", InsertOptionSimpleEnum { e }) + .call_reducer("insert_option_simple_enum", InsertOptionSimpleEnumArgs { e }) } fn on_insert_option_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionSimpleEnumCallbackId { - InsertOptionSimpleEnumCallbackId(self.imp.on_reducer::( + InsertOptionSimpleEnumCallbackId(self.imp.on_reducer( "insert_option_simple_enum", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionSimpleEnum| callback(ctx, &args.e)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionSimpleEnum { e }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, e) + }), )) } fn remove_on_insert_option_simple_enum(&self, callback: InsertOptionSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_option_simple_enum", callback.0) + self.imp.remove_on_reducer("insert_option_simple_enum", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs index e678d9982a..fc238c09d8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionString { +pub(super) struct InsertOptionStringArgs { pub s: Option, } -impl __sdk::InModule for InsertOptionString { +impl From for super::Reducer { + fn from(args: InsertOptionStringArgs) -> Self { + Self::InsertOptionString { s: args.s } + } +} + +impl __sdk::InModule for InsertOptionStringArgs { type Module = super::RemoteModule; } @@ -51,20 +57,33 @@ pub trait insert_option_string { impl insert_option_string for super::RemoteReducers { fn insert_option_string(&self, s: Option) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_option_string", InsertOptionString { s }) + self.imp + .call_reducer("insert_option_string", InsertOptionStringArgs { s }) } fn on_insert_option_string( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionStringCallbackId { - InsertOptionStringCallbackId(self.imp.on_reducer::( + InsertOptionStringCallbackId(self.imp.on_reducer( "insert_option_string", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionString| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionString { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_option_string(&self, callback: InsertOptionStringCallbackId) { - self.imp - .remove_on_reducer::("insert_option_string", callback.0) + self.imp.remove_on_reducer("insert_option_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs index 11256ed92e..3a97056994 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertOptionVecOptionI32 { +pub(super) struct InsertOptionVecOptionI32Args { pub v: Option>>, } -impl __sdk::InModule for InsertOptionVecOptionI32 { +impl From for super::Reducer { + fn from(args: InsertOptionVecOptionI32Args) -> Self { + Self::InsertOptionVecOptionI32 { v: args.v } + } +} + +impl __sdk::InModule for InsertOptionVecOptionI32Args { type Module = super::RemoteModule; } @@ -52,20 +58,32 @@ pub trait insert_option_vec_option_i_32 { impl insert_option_vec_option_i_32 for super::RemoteReducers { fn insert_option_vec_option_i_32(&self, v: Option>>) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_option_vec_option_i32", InsertOptionVecOptionI32 { v }) + .call_reducer("insert_option_vec_option_i32", InsertOptionVecOptionI32Args { v }) } fn on_insert_option_vec_option_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Option>>) + Send + 'static, ) -> InsertOptionVecOptionI32CallbackId { - InsertOptionVecOptionI32CallbackId(self.imp.on_reducer::( + InsertOptionVecOptionI32CallbackId(self.imp.on_reducer( "insert_option_vec_option_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertOptionVecOptionI32| callback(ctx, &args.v)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertOptionVecOptionI32 { v }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, v) + }), )) } fn remove_on_insert_option_vec_option_i_32(&self, callback: InsertOptionVecOptionI32CallbackId) { - self.imp - .remove_on_reducer::("insert_option_vec_option_i32", callback.0) + self.imp.remove_on_reducer("insert_option_vec_option_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs index 10617ed533..61c0004fb2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkAddress { +pub(super) struct InsertPkAddressArgs { pub a: __sdk::Address, pub data: i32, } -impl __sdk::InModule for InsertPkAddress { +impl From for super::Reducer { + fn from(args: InsertPkAddressArgs) -> Self { + Self::InsertPkAddress { + a: args.a, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkAddressArgs { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_pk_address { impl insert_pk_address for super::RemoteReducers { fn insert_pk_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_address", InsertPkAddress { a, data }) + self.imp + .call_reducer("insert_pk_address", InsertPkAddressArgs { a, data }) } fn on_insert_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> InsertPkAddressCallbackId { - InsertPkAddressCallbackId(self.imp.on_reducer::( + InsertPkAddressCallbackId(self.imp.on_reducer( "insert_pk_address", - Box::new(move |ctx: &super::EventContext, args: &InsertPkAddress| callback(ctx, &args.a, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkAddress { a, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, data) + }), )) } fn remove_on_insert_pk_address(&self, callback: InsertPkAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_address", callback.0) + self.imp.remove_on_reducer("insert_pk_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs index bd5e2e2ea1..d835aae49d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkBool { +pub(super) struct InsertPkBoolArgs { pub b: bool, pub data: i32, } -impl __sdk::InModule for InsertPkBool { +impl From for super::Reducer { + fn from(args: InsertPkBoolArgs) -> Self { + Self::InsertPkBool { + b: args.b, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkBoolArgs { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_bool { impl insert_pk_bool for super::RemoteReducers { fn insert_pk_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_bool", InsertPkBool { b, data }) + self.imp.call_reducer("insert_pk_bool", InsertPkBoolArgs { b, data }) } fn on_insert_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> InsertPkBoolCallbackId { - InsertPkBoolCallbackId(self.imp.on_reducer::( + InsertPkBoolCallbackId(self.imp.on_reducer( "insert_pk_bool", - Box::new(move |ctx: &super::EventContext, args: &InsertPkBool| callback(ctx, &args.b, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkBool { b, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b, data) + }), )) } fn remove_on_insert_pk_bool(&self, callback: InsertPkBoolCallbackId) { - self.imp.remove_on_reducer::("insert_pk_bool", callback.0) + self.imp.remove_on_reducer("insert_pk_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs index 47e622065a..ef1b32e33b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI128 { +pub(super) struct InsertPkI128Args { pub n: i128, pub data: i32, } -impl __sdk::InModule for InsertPkI128 { +impl From for super::Reducer { + fn from(args: InsertPkI128Args) -> Self { + Self::InsertPkI128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI128Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_128 { impl insert_pk_i_128 for super::RemoteReducers { fn insert_pk_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i128", InsertPkI128 { n, data }) + self.imp.call_reducer("insert_pk_i128", InsertPkI128Args { n, data }) } fn on_insert_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> InsertPkI128CallbackId { - InsertPkI128CallbackId(self.imp.on_reducer::( + InsertPkI128CallbackId(self.imp.on_reducer( "insert_pk_i128", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_128(&self, callback: InsertPkI128CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i128", callback.0) + self.imp.remove_on_reducer("insert_pk_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs index 3df97495bd..0bcb1bcc62 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI16 { +pub(super) struct InsertPkI16Args { pub n: i16, pub data: i32, } -impl __sdk::InModule for InsertPkI16 { +impl From for super::Reducer { + fn from(args: InsertPkI16Args) -> Self { + Self::InsertPkI16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI16Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_16 { impl insert_pk_i_16 for super::RemoteReducers { fn insert_pk_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i16", InsertPkI16 { n, data }) + self.imp.call_reducer("insert_pk_i16", InsertPkI16Args { n, data }) } fn on_insert_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> InsertPkI16CallbackId { - InsertPkI16CallbackId(self.imp.on_reducer::( + InsertPkI16CallbackId(self.imp.on_reducer( "insert_pk_i16", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_16(&self, callback: InsertPkI16CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i16", callback.0) + self.imp.remove_on_reducer("insert_pk_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs index dcf329b11f..f4faae41b8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI256 { +pub(super) struct InsertPkI256Args { pub n: __sats::i256, pub data: i32, } -impl __sdk::InModule for InsertPkI256 { +impl From for super::Reducer { + fn from(args: InsertPkI256Args) -> Self { + Self::InsertPkI256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI256Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_256 { impl insert_pk_i_256 for super::RemoteReducers { fn insert_pk_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i256", InsertPkI256 { n, data }) + self.imp.call_reducer("insert_pk_i256", InsertPkI256Args { n, data }) } fn on_insert_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> InsertPkI256CallbackId { - InsertPkI256CallbackId(self.imp.on_reducer::( + InsertPkI256CallbackId(self.imp.on_reducer( "insert_pk_i256", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_256(&self, callback: InsertPkI256CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i256", callback.0) + self.imp.remove_on_reducer("insert_pk_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs index 51cd434884..1a73e884d3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI32 { +pub(super) struct InsertPkI32Args { pub n: i32, pub data: i32, } -impl __sdk::InModule for InsertPkI32 { +impl From for super::Reducer { + fn from(args: InsertPkI32Args) -> Self { + Self::InsertPkI32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI32Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_32 { impl insert_pk_i_32 for super::RemoteReducers { fn insert_pk_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i32", InsertPkI32 { n, data }) + self.imp.call_reducer("insert_pk_i32", InsertPkI32Args { n, data }) } fn on_insert_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> InsertPkI32CallbackId { - InsertPkI32CallbackId(self.imp.on_reducer::( + InsertPkI32CallbackId(self.imp.on_reducer( "insert_pk_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_32(&self, callback: InsertPkI32CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i32", callback.0) + self.imp.remove_on_reducer("insert_pk_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs index 7bdd8955a7..aaddb742e3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI64 { +pub(super) struct InsertPkI64Args { pub n: i64, pub data: i32, } -impl __sdk::InModule for InsertPkI64 { +impl From for super::Reducer { + fn from(args: InsertPkI64Args) -> Self { + Self::InsertPkI64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI64Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_64 { impl insert_pk_i_64 for super::RemoteReducers { fn insert_pk_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i64", InsertPkI64 { n, data }) + self.imp.call_reducer("insert_pk_i64", InsertPkI64Args { n, data }) } fn on_insert_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> InsertPkI64CallbackId { - InsertPkI64CallbackId(self.imp.on_reducer::( + InsertPkI64CallbackId(self.imp.on_reducer( "insert_pk_i64", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_64(&self, callback: InsertPkI64CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i64", callback.0) + self.imp.remove_on_reducer("insert_pk_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs index 3d889eb34b..6dfd2f38b4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkI8 { +pub(super) struct InsertPkI8Args { pub n: i8, pub data: i32, } -impl __sdk::InModule for InsertPkI8 { +impl From for super::Reducer { + fn from(args: InsertPkI8Args) -> Self { + Self::InsertPkI8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkI8Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_i_8 { impl insert_pk_i_8 for super::RemoteReducers { fn insert_pk_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i8", InsertPkI8 { n, data }) + self.imp.call_reducer("insert_pk_i8", InsertPkI8Args { n, data }) } fn on_insert_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> InsertPkI8CallbackId { - InsertPkI8CallbackId(self.imp.on_reducer::( + InsertPkI8CallbackId(self.imp.on_reducer( "insert_pk_i8", - Box::new(move |ctx: &super::EventContext, args: &InsertPkI8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkI8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_i_8(&self, callback: InsertPkI8CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i8", callback.0) + self.imp.remove_on_reducer("insert_pk_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs index 8b0e365717..c5a7669405 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkIdentity { +pub(super) struct InsertPkIdentityArgs { pub i: __sdk::Identity, pub data: i32, } -impl __sdk::InModule for InsertPkIdentity { +impl From for super::Reducer { + fn from(args: InsertPkIdentityArgs) -> Self { + Self::InsertPkIdentity { + i: args.i, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkIdentityArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_pk_identity { impl insert_pk_identity for super::RemoteReducers { fn insert_pk_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_pk_identity", InsertPkIdentity { i, data }) + .call_reducer("insert_pk_identity", InsertPkIdentityArgs { i, data }) } fn on_insert_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> InsertPkIdentityCallbackId { - InsertPkIdentityCallbackId(self.imp.on_reducer::( + InsertPkIdentityCallbackId(self.imp.on_reducer( "insert_pk_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertPkIdentity| callback(ctx, &args.i, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkIdentity { i, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i, data) + }), )) } fn remove_on_insert_pk_identity(&self, callback: InsertPkIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_identity", callback.0) + self.imp.remove_on_reducer("insert_pk_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs index 715637ee17..73b3063753 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkString { +pub(super) struct InsertPkStringArgs { pub s: String, pub data: i32, } -impl __sdk::InModule for InsertPkString { +impl From for super::Reducer { + fn from(args: InsertPkStringArgs) -> Self { + Self::InsertPkString { + s: args.s, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkStringArgs { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_pk_string { impl insert_pk_string for super::RemoteReducers { fn insert_pk_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_string", InsertPkString { s, data }) + self.imp + .call_reducer("insert_pk_string", InsertPkStringArgs { s, data }) } fn on_insert_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> InsertPkStringCallbackId { - InsertPkStringCallbackId(self.imp.on_reducer::( + InsertPkStringCallbackId(self.imp.on_reducer( "insert_pk_string", - Box::new(move |ctx: &super::EventContext, args: &InsertPkString| callback(ctx, &args.s, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkString { s, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s, data) + }), )) } fn remove_on_insert_pk_string(&self, callback: InsertPkStringCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_string", callback.0) + self.imp.remove_on_reducer("insert_pk_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs index 247783e244..3dd088dd66 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU128 { +pub(super) struct InsertPkU128Args { pub n: u128, pub data: i32, } -impl __sdk::InModule for InsertPkU128 { +impl From for super::Reducer { + fn from(args: InsertPkU128Args) -> Self { + Self::InsertPkU128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU128Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_128 { impl insert_pk_u_128 for super::RemoteReducers { fn insert_pk_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u128", InsertPkU128 { n, data }) + self.imp.call_reducer("insert_pk_u128", InsertPkU128Args { n, data }) } fn on_insert_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> InsertPkU128CallbackId { - InsertPkU128CallbackId(self.imp.on_reducer::( + InsertPkU128CallbackId(self.imp.on_reducer( "insert_pk_u128", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_128(&self, callback: InsertPkU128CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u128", callback.0) + self.imp.remove_on_reducer("insert_pk_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs index 18112c0817..8d53fd031f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU16 { +pub(super) struct InsertPkU16Args { pub n: u16, pub data: i32, } -impl __sdk::InModule for InsertPkU16 { +impl From for super::Reducer { + fn from(args: InsertPkU16Args) -> Self { + Self::InsertPkU16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU16Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_16 { impl insert_pk_u_16 for super::RemoteReducers { fn insert_pk_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u16", InsertPkU16 { n, data }) + self.imp.call_reducer("insert_pk_u16", InsertPkU16Args { n, data }) } fn on_insert_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> InsertPkU16CallbackId { - InsertPkU16CallbackId(self.imp.on_reducer::( + InsertPkU16CallbackId(self.imp.on_reducer( "insert_pk_u16", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_16(&self, callback: InsertPkU16CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u16", callback.0) + self.imp.remove_on_reducer("insert_pk_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs index b6e0c29cd5..d6907302cf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU256 { +pub(super) struct InsertPkU256Args { pub n: __sats::u256, pub data: i32, } -impl __sdk::InModule for InsertPkU256 { +impl From for super::Reducer { + fn from(args: InsertPkU256Args) -> Self { + Self::InsertPkU256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU256Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_256 { impl insert_pk_u_256 for super::RemoteReducers { fn insert_pk_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u256", InsertPkU256 { n, data }) + self.imp.call_reducer("insert_pk_u256", InsertPkU256Args { n, data }) } fn on_insert_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> InsertPkU256CallbackId { - InsertPkU256CallbackId(self.imp.on_reducer::( + InsertPkU256CallbackId(self.imp.on_reducer( "insert_pk_u256", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_256(&self, callback: InsertPkU256CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u256", callback.0) + self.imp.remove_on_reducer("insert_pk_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs index 35aec61e58..24b1a7456b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU32 { +pub(super) struct InsertPkU32Args { pub n: u32, pub data: i32, } -impl __sdk::InModule for InsertPkU32 { +impl From for super::Reducer { + fn from(args: InsertPkU32Args) -> Self { + Self::InsertPkU32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU32Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_32 { impl insert_pk_u_32 for super::RemoteReducers { fn insert_pk_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u32", InsertPkU32 { n, data }) + self.imp.call_reducer("insert_pk_u32", InsertPkU32Args { n, data }) } fn on_insert_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> InsertPkU32CallbackId { - InsertPkU32CallbackId(self.imp.on_reducer::( + InsertPkU32CallbackId(self.imp.on_reducer( "insert_pk_u32", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_32(&self, callback: InsertPkU32CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u32", callback.0) + self.imp.remove_on_reducer("insert_pk_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs index 31ac5a3727..cb82f2e4ee 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU64 { +pub(super) struct InsertPkU64Args { pub n: u64, pub data: i32, } -impl __sdk::InModule for InsertPkU64 { +impl From for super::Reducer { + fn from(args: InsertPkU64Args) -> Self { + Self::InsertPkU64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU64Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_64 { impl insert_pk_u_64 for super::RemoteReducers { fn insert_pk_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u64", InsertPkU64 { n, data }) + self.imp.call_reducer("insert_pk_u64", InsertPkU64Args { n, data }) } fn on_insert_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> InsertPkU64CallbackId { - InsertPkU64CallbackId(self.imp.on_reducer::( + InsertPkU64CallbackId(self.imp.on_reducer( "insert_pk_u64", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_64(&self, callback: InsertPkU64CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u64", callback.0) + self.imp.remove_on_reducer("insert_pk_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs index 72ffccfdfb..fdad9f9e7e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPkU8 { +pub(super) struct InsertPkU8Args { pub n: u8, pub data: i32, } -impl __sdk::InModule for InsertPkU8 { +impl From for super::Reducer { + fn from(args: InsertPkU8Args) -> Self { + Self::InsertPkU8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertPkU8Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait insert_pk_u_8 { impl insert_pk_u_8 for super::RemoteReducers { fn insert_pk_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u8", InsertPkU8 { n, data }) + self.imp.call_reducer("insert_pk_u8", InsertPkU8Args { n, data }) } fn on_insert_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> InsertPkU8CallbackId { - InsertPkU8CallbackId(self.imp.on_reducer::( + InsertPkU8CallbackId(self.imp.on_reducer( "insert_pk_u8", - Box::new(move |ctx: &super::EventContext, args: &InsertPkU8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPkU8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_pk_u_8(&self, callback: InsertPkU8CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u8", callback.0) + self.imp.remove_on_reducer("insert_pk_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs index 1998c5c035..416fb4908f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs @@ -11,11 +11,17 @@ use super::every_primitive_struct_type::EveryPrimitiveStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertPrimitivesAsStrings { +pub(super) struct InsertPrimitivesAsStringsArgs { pub s: EveryPrimitiveStruct, } -impl __sdk::InModule for InsertPrimitivesAsStrings { +impl From for super::Reducer { + fn from(args: InsertPrimitivesAsStringsArgs) -> Self { + Self::InsertPrimitivesAsStrings { s: args.s } + } +} + +impl __sdk::InModule for InsertPrimitivesAsStringsArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_primitives_as_strings { impl insert_primitives_as_strings for super::RemoteReducers { fn insert_primitives_as_strings(&self, s: EveryPrimitiveStruct) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_primitives_as_strings", InsertPrimitivesAsStrings { s }) + .call_reducer("insert_primitives_as_strings", InsertPrimitivesAsStringsArgs { s }) } fn on_insert_primitives_as_strings( &self, mut callback: impl FnMut(&super::EventContext, &EveryPrimitiveStruct) + Send + 'static, ) -> InsertPrimitivesAsStringsCallbackId { - InsertPrimitivesAsStringsCallbackId(self.imp.on_reducer::( + InsertPrimitivesAsStringsCallbackId(self.imp.on_reducer( "insert_primitives_as_strings", - Box::new(move |ctx: &super::EventContext, args: &InsertPrimitivesAsStrings| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertPrimitivesAsStrings { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_primitives_as_strings(&self, callback: InsertPrimitivesAsStringsCallbackId) { - self.imp - .remove_on_reducer::("insert_primitives_as_strings", callback.0) + self.imp.remove_on_reducer("insert_primitives_as_strings", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs index 91d05d9f11..2ba2fce361 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs @@ -12,12 +12,18 @@ use super::vec_u_8_type::VecU8; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertTableHoldsTable { +pub(super) struct InsertTableHoldsTableArgs { pub a: OneU8, pub b: VecU8, } -impl __sdk::InModule for InsertTableHoldsTable { +impl From for super::Reducer { + fn from(args: InsertTableHoldsTableArgs) -> Self { + Self::InsertTableHoldsTable { a: args.a, b: args.b } + } +} + +impl __sdk::InModule for InsertTableHoldsTableArgs { type Module = super::RemoteModule; } @@ -56,20 +62,32 @@ pub trait insert_table_holds_table { impl insert_table_holds_table for super::RemoteReducers { fn insert_table_holds_table(&self, a: OneU8, b: VecU8) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_table_holds_table", InsertTableHoldsTable { a, b }) + .call_reducer("insert_table_holds_table", InsertTableHoldsTableArgs { a, b }) } fn on_insert_table_holds_table( &self, mut callback: impl FnMut(&super::EventContext, &OneU8, &VecU8) + Send + 'static, ) -> InsertTableHoldsTableCallbackId { - InsertTableHoldsTableCallbackId(self.imp.on_reducer::( + InsertTableHoldsTableCallbackId(self.imp.on_reducer( "insert_table_holds_table", - Box::new(move |ctx: &super::EventContext, args: &InsertTableHoldsTable| callback(ctx, &args.a, &args.b)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertTableHoldsTable { a, b }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, b) + }), )) } fn remove_on_insert_table_holds_table(&self, callback: InsertTableHoldsTableCallbackId) { - self.imp - .remove_on_reducer::("insert_table_holds_table", callback.0) + self.imp.remove_on_reducer("insert_table_holds_table", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs index ed1a871eb1..4d0d237206 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueAddress { +pub(super) struct InsertUniqueAddressArgs { pub a: __sdk::Address, pub data: i32, } -impl __sdk::InModule for InsertUniqueAddress { +impl From for super::Reducer { + fn from(args: InsertUniqueAddressArgs) -> Self { + Self::InsertUniqueAddress { + a: args.a, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueAddressArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_address { impl insert_unique_address for super::RemoteReducers { fn insert_unique_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_address", InsertUniqueAddress { a, data }) + .call_reducer("insert_unique_address", InsertUniqueAddressArgs { a, data }) } fn on_insert_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> InsertUniqueAddressCallbackId { - InsertUniqueAddressCallbackId(self.imp.on_reducer::( + InsertUniqueAddressCallbackId(self.imp.on_reducer( "insert_unique_address", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueAddress| callback(ctx, &args.a, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueAddress { a, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, data) + }), )) } fn remove_on_insert_unique_address(&self, callback: InsertUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_address", callback.0) + self.imp.remove_on_reducer("insert_unique_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs index bd833073c9..5b69e95a1c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueBool { +pub(super) struct InsertUniqueBoolArgs { pub b: bool, pub data: i32, } -impl __sdk::InModule for InsertUniqueBool { +impl From for super::Reducer { + fn from(args: InsertUniqueBoolArgs) -> Self { + Self::InsertUniqueBool { + b: args.b, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueBoolArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_bool { impl insert_unique_bool for super::RemoteReducers { fn insert_unique_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_bool", InsertUniqueBool { b, data }) + .call_reducer("insert_unique_bool", InsertUniqueBoolArgs { b, data }) } fn on_insert_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> InsertUniqueBoolCallbackId { - InsertUniqueBoolCallbackId(self.imp.on_reducer::( + InsertUniqueBoolCallbackId(self.imp.on_reducer( "insert_unique_bool", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueBool| callback(ctx, &args.b, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueBool { b, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b, data) + }), )) } fn remove_on_insert_unique_bool(&self, callback: InsertUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_bool", callback.0) + self.imp.remove_on_reducer("insert_unique_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs index 44cc910eee..fc9d0426bb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI128 { +pub(super) struct InsertUniqueI128Args { pub n: i128, pub data: i32, } -impl __sdk::InModule for InsertUniqueI128 { +impl From for super::Reducer { + fn from(args: InsertUniqueI128Args) -> Self { + Self::InsertUniqueI128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI128Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_i_128 { impl insert_unique_i_128 for super::RemoteReducers { fn insert_unique_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_i128", InsertUniqueI128 { n, data }) + .call_reducer("insert_unique_i128", InsertUniqueI128Args { n, data }) } fn on_insert_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> InsertUniqueI128CallbackId { - InsertUniqueI128CallbackId(self.imp.on_reducer::( + InsertUniqueI128CallbackId(self.imp.on_reducer( "insert_unique_i128", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_128(&self, callback: InsertUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i128", callback.0) + self.imp.remove_on_reducer("insert_unique_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs index 3c0f776bbc..562b5df700 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI16 { +pub(super) struct InsertUniqueI16Args { pub n: i16, pub data: i32, } -impl __sdk::InModule for InsertUniqueI16 { +impl From for super::Reducer { + fn from(args: InsertUniqueI16Args) -> Self { + Self::InsertUniqueI16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI16Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_i_16 { impl insert_unique_i_16 for super::RemoteReducers { fn insert_unique_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i16", InsertUniqueI16 { n, data }) + self.imp + .call_reducer("insert_unique_i16", InsertUniqueI16Args { n, data }) } fn on_insert_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> InsertUniqueI16CallbackId { - InsertUniqueI16CallbackId(self.imp.on_reducer::( + InsertUniqueI16CallbackId(self.imp.on_reducer( "insert_unique_i16", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_16(&self, callback: InsertUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i16", callback.0) + self.imp.remove_on_reducer("insert_unique_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs index 4dd072330a..27ef2559a8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI256 { +pub(super) struct InsertUniqueI256Args { pub n: __sats::i256, pub data: i32, } -impl __sdk::InModule for InsertUniqueI256 { +impl From for super::Reducer { + fn from(args: InsertUniqueI256Args) -> Self { + Self::InsertUniqueI256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI256Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_i_256 { impl insert_unique_i_256 for super::RemoteReducers { fn insert_unique_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_i256", InsertUniqueI256 { n, data }) + .call_reducer("insert_unique_i256", InsertUniqueI256Args { n, data }) } fn on_insert_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> InsertUniqueI256CallbackId { - InsertUniqueI256CallbackId(self.imp.on_reducer::( + InsertUniqueI256CallbackId(self.imp.on_reducer( "insert_unique_i256", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_256(&self, callback: InsertUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i256", callback.0) + self.imp.remove_on_reducer("insert_unique_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs index aac90fba44..331b5d62ea 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI32 { +pub(super) struct InsertUniqueI32Args { pub n: i32, pub data: i32, } -impl __sdk::InModule for InsertUniqueI32 { +impl From for super::Reducer { + fn from(args: InsertUniqueI32Args) -> Self { + Self::InsertUniqueI32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI32Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_i_32 { impl insert_unique_i_32 for super::RemoteReducers { fn insert_unique_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i32", InsertUniqueI32 { n, data }) + self.imp + .call_reducer("insert_unique_i32", InsertUniqueI32Args { n, data }) } fn on_insert_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> InsertUniqueI32CallbackId { - InsertUniqueI32CallbackId(self.imp.on_reducer::( + InsertUniqueI32CallbackId(self.imp.on_reducer( "insert_unique_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_32(&self, callback: InsertUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i32", callback.0) + self.imp.remove_on_reducer("insert_unique_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs index 54811779f3..bf5d4ae2f0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI64 { +pub(super) struct InsertUniqueI64Args { pub n: i64, pub data: i32, } -impl __sdk::InModule for InsertUniqueI64 { +impl From for super::Reducer { + fn from(args: InsertUniqueI64Args) -> Self { + Self::InsertUniqueI64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI64Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_i_64 { impl insert_unique_i_64 for super::RemoteReducers { fn insert_unique_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i64", InsertUniqueI64 { n, data }) + self.imp + .call_reducer("insert_unique_i64", InsertUniqueI64Args { n, data }) } fn on_insert_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> InsertUniqueI64CallbackId { - InsertUniqueI64CallbackId(self.imp.on_reducer::( + InsertUniqueI64CallbackId(self.imp.on_reducer( "insert_unique_i64", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_64(&self, callback: InsertUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i64", callback.0) + self.imp.remove_on_reducer("insert_unique_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs index c235cb063a..6ffb922794 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueI8 { +pub(super) struct InsertUniqueI8Args { pub n: i8, pub data: i32, } -impl __sdk::InModule for InsertUniqueI8 { +impl From for super::Reducer { + fn from(args: InsertUniqueI8Args) -> Self { + Self::InsertUniqueI8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueI8Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_i_8 { impl insert_unique_i_8 for super::RemoteReducers { fn insert_unique_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i8", InsertUniqueI8 { n, data }) + self.imp + .call_reducer("insert_unique_i8", InsertUniqueI8Args { n, data }) } fn on_insert_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> InsertUniqueI8CallbackId { - InsertUniqueI8CallbackId(self.imp.on_reducer::( + InsertUniqueI8CallbackId(self.imp.on_reducer( "insert_unique_i8", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueI8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_i_8(&self, callback: InsertUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i8", callback.0) + self.imp.remove_on_reducer("insert_unique_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs index ae2add5a74..858d4814ea 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueIdentity { +pub(super) struct InsertUniqueIdentityArgs { pub i: __sdk::Identity, pub data: i32, } -impl __sdk::InModule for InsertUniqueIdentity { +impl From for super::Reducer { + fn from(args: InsertUniqueIdentityArgs) -> Self { + Self::InsertUniqueIdentity { + i: args.i, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueIdentityArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_identity { impl insert_unique_identity for super::RemoteReducers { fn insert_unique_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_identity", InsertUniqueIdentity { i, data }) + .call_reducer("insert_unique_identity", InsertUniqueIdentityArgs { i, data }) } fn on_insert_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> InsertUniqueIdentityCallbackId { - InsertUniqueIdentityCallbackId(self.imp.on_reducer::( + InsertUniqueIdentityCallbackId(self.imp.on_reducer( "insert_unique_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueIdentity| callback(ctx, &args.i, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueIdentity { i, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i, data) + }), )) } fn remove_on_insert_unique_identity(&self, callback: InsertUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_identity", callback.0) + self.imp.remove_on_reducer("insert_unique_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs index eb99274902..ec033a1247 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueString { +pub(super) struct InsertUniqueStringArgs { pub s: String, pub data: i32, } -impl __sdk::InModule for InsertUniqueString { +impl From for super::Reducer { + fn from(args: InsertUniqueStringArgs) -> Self { + Self::InsertUniqueString { + s: args.s, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueStringArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_string { impl insert_unique_string for super::RemoteReducers { fn insert_unique_string(&self, s: String, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_string", InsertUniqueString { s, data }) + .call_reducer("insert_unique_string", InsertUniqueStringArgs { s, data }) } fn on_insert_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> InsertUniqueStringCallbackId { - InsertUniqueStringCallbackId(self.imp.on_reducer::( + InsertUniqueStringCallbackId(self.imp.on_reducer( "insert_unique_string", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueString| callback(ctx, &args.s, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueString { s, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s, data) + }), )) } fn remove_on_insert_unique_string(&self, callback: InsertUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_string", callback.0) + self.imp.remove_on_reducer("insert_unique_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs index 2a40f8185b..c05908488d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU128 { +pub(super) struct InsertUniqueU128Args { pub n: u128, pub data: i32, } -impl __sdk::InModule for InsertUniqueU128 { +impl From for super::Reducer { + fn from(args: InsertUniqueU128Args) -> Self { + Self::InsertUniqueU128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU128Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_u_128 { impl insert_unique_u_128 for super::RemoteReducers { fn insert_unique_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_u128", InsertUniqueU128 { n, data }) + .call_reducer("insert_unique_u128", InsertUniqueU128Args { n, data }) } fn on_insert_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> InsertUniqueU128CallbackId { - InsertUniqueU128CallbackId(self.imp.on_reducer::( + InsertUniqueU128CallbackId(self.imp.on_reducer( "insert_unique_u128", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_128(&self, callback: InsertUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u128", callback.0) + self.imp.remove_on_reducer("insert_unique_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs index 4269934a6b..3bdeac4e44 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU16 { +pub(super) struct InsertUniqueU16Args { pub n: u16, pub data: i32, } -impl __sdk::InModule for InsertUniqueU16 { +impl From for super::Reducer { + fn from(args: InsertUniqueU16Args) -> Self { + Self::InsertUniqueU16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU16Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_u_16 { impl insert_unique_u_16 for super::RemoteReducers { fn insert_unique_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u16", InsertUniqueU16 { n, data }) + self.imp + .call_reducer("insert_unique_u16", InsertUniqueU16Args { n, data }) } fn on_insert_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> InsertUniqueU16CallbackId { - InsertUniqueU16CallbackId(self.imp.on_reducer::( + InsertUniqueU16CallbackId(self.imp.on_reducer( "insert_unique_u16", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_16(&self, callback: InsertUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u16", callback.0) + self.imp.remove_on_reducer("insert_unique_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs index c615e8b213..b4a7116da3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU256 { +pub(super) struct InsertUniqueU256Args { pub n: __sats::u256, pub data: i32, } -impl __sdk::InModule for InsertUniqueU256 { +impl From for super::Reducer { + fn from(args: InsertUniqueU256Args) -> Self { + Self::InsertUniqueU256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU256Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait insert_unique_u_256 { impl insert_unique_u_256 for super::RemoteReducers { fn insert_unique_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_unique_u256", InsertUniqueU256 { n, data }) + .call_reducer("insert_unique_u256", InsertUniqueU256Args { n, data }) } fn on_insert_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> InsertUniqueU256CallbackId { - InsertUniqueU256CallbackId(self.imp.on_reducer::( + InsertUniqueU256CallbackId(self.imp.on_reducer( "insert_unique_u256", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_256(&self, callback: InsertUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u256", callback.0) + self.imp.remove_on_reducer("insert_unique_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs index 4b26bc18b0..449d7c7338 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU32 { +pub(super) struct InsertUniqueU32Args { pub n: u32, pub data: i32, } -impl __sdk::InModule for InsertUniqueU32 { +impl From for super::Reducer { + fn from(args: InsertUniqueU32Args) -> Self { + Self::InsertUniqueU32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU32Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_u_32 { impl insert_unique_u_32 for super::RemoteReducers { fn insert_unique_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u32", InsertUniqueU32 { n, data }) + self.imp + .call_reducer("insert_unique_u32", InsertUniqueU32Args { n, data }) } fn on_insert_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> InsertUniqueU32CallbackId { - InsertUniqueU32CallbackId(self.imp.on_reducer::( + InsertUniqueU32CallbackId(self.imp.on_reducer( "insert_unique_u32", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_32(&self, callback: InsertUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u32", callback.0) + self.imp.remove_on_reducer("insert_unique_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs index 89c190bee0..a58c598f9e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU64 { +pub(super) struct InsertUniqueU64Args { pub n: u64, pub data: i32, } -impl __sdk::InModule for InsertUniqueU64 { +impl From for super::Reducer { + fn from(args: InsertUniqueU64Args) -> Self { + Self::InsertUniqueU64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU64Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_u_64 { impl insert_unique_u_64 for super::RemoteReducers { fn insert_unique_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u64", InsertUniqueU64 { n, data }) + self.imp + .call_reducer("insert_unique_u64", InsertUniqueU64Args { n, data }) } fn on_insert_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> InsertUniqueU64CallbackId { - InsertUniqueU64CallbackId(self.imp.on_reducer::( + InsertUniqueU64CallbackId(self.imp.on_reducer( "insert_unique_u64", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_64(&self, callback: InsertUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u64", callback.0) + self.imp.remove_on_reducer("insert_unique_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs index 5f4f42ae51..ca2334ce77 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertUniqueU8 { +pub(super) struct InsertUniqueU8Args { pub n: u8, pub data: i32, } -impl __sdk::InModule for InsertUniqueU8 { +impl From for super::Reducer { + fn from(args: InsertUniqueU8Args) -> Self { + Self::InsertUniqueU8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for InsertUniqueU8Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait insert_unique_u_8 { impl insert_unique_u_8 for super::RemoteReducers { fn insert_unique_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u8", InsertUniqueU8 { n, data }) + self.imp + .call_reducer("insert_unique_u8", InsertUniqueU8Args { n, data }) } fn on_insert_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> InsertUniqueU8CallbackId { - InsertUniqueU8CallbackId(self.imp.on_reducer::( + InsertUniqueU8CallbackId(self.imp.on_reducer( "insert_unique_u8", - Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertUniqueU8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_insert_unique_u_8(&self, callback: InsertUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u8", callback.0) + self.imp.remove_on_reducer("insert_unique_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs index 961da98f71..781b71b490 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecAddress { +pub(super) struct InsertVecAddressArgs { pub a: Vec<__sdk::Address>, } -impl __sdk::InModule for InsertVecAddress { +impl From for super::Reducer { + fn from(args: InsertVecAddressArgs) -> Self { + Self::InsertVecAddress { a: args.a } + } +} + +impl __sdk::InModule for InsertVecAddressArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_address { impl insert_vec_address for super::RemoteReducers { fn insert_vec_address(&self, a: Vec<__sdk::Address>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_address", InsertVecAddress { a }) + self.imp.call_reducer("insert_vec_address", InsertVecAddressArgs { a }) } fn on_insert_vec_address( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sdk::Address>) + Send + 'static, ) -> InsertVecAddressCallbackId { - InsertVecAddressCallbackId(self.imp.on_reducer::( + InsertVecAddressCallbackId(self.imp.on_reducer( "insert_vec_address", - Box::new(move |ctx: &super::EventContext, args: &InsertVecAddress| callback(ctx, &args.a)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecAddress { a }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a) + }), )) } fn remove_on_insert_vec_address(&self, callback: InsertVecAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_address", callback.0) + self.imp.remove_on_reducer("insert_vec_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs index 72a0ab41f2..8818df9cba 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecBool { +pub(super) struct InsertVecBoolArgs { pub b: Vec, } -impl __sdk::InModule for InsertVecBool { +impl From for super::Reducer { + fn from(args: InsertVecBoolArgs) -> Self { + Self::InsertVecBool { b: args.b } + } +} + +impl __sdk::InModule for InsertVecBoolArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_bool { impl insert_vec_bool for super::RemoteReducers { fn insert_vec_bool(&self, b: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_bool", InsertVecBool { b }) + self.imp.call_reducer("insert_vec_bool", InsertVecBoolArgs { b }) } fn on_insert_vec_bool( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecBoolCallbackId { - InsertVecBoolCallbackId(self.imp.on_reducer::( + InsertVecBoolCallbackId(self.imp.on_reducer( "insert_vec_bool", - Box::new(move |ctx: &super::EventContext, args: &InsertVecBool| callback(ctx, &args.b)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecBool { b }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b) + }), )) } fn remove_on_insert_vec_bool(&self, callback: InsertVecBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_bool", callback.0) + self.imp.remove_on_reducer("insert_vec_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs index 67f2736558..5660741209 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs @@ -11,11 +11,17 @@ use super::byte_struct_type::ByteStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecByteStruct { +pub(super) struct InsertVecByteStructArgs { pub s: Vec, } -impl __sdk::InModule for InsertVecByteStruct { +impl From for super::Reducer { + fn from(args: InsertVecByteStructArgs) -> Self { + Self::InsertVecByteStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertVecByteStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_vec_byte_struct { impl insert_vec_byte_struct for super::RemoteReducers { fn insert_vec_byte_struct(&self, s: Vec) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_vec_byte_struct", InsertVecByteStruct { s }) + .call_reducer("insert_vec_byte_struct", InsertVecByteStructArgs { s }) } fn on_insert_vec_byte_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecByteStructCallbackId { - InsertVecByteStructCallbackId(self.imp.on_reducer::( + InsertVecByteStructCallbackId(self.imp.on_reducer( "insert_vec_byte_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertVecByteStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecByteStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_vec_byte_struct(&self, callback: InsertVecByteStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_byte_struct", callback.0) + self.imp.remove_on_reducer("insert_vec_byte_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs index ec50f82227..ce7e92293a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs @@ -11,11 +11,17 @@ use super::enum_with_payload_type::EnumWithPayload; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecEnumWithPayload { +pub(super) struct InsertVecEnumWithPayloadArgs { pub e: Vec, } -impl __sdk::InModule for InsertVecEnumWithPayload { +impl From for super::Reducer { + fn from(args: InsertVecEnumWithPayloadArgs) -> Self { + Self::InsertVecEnumWithPayload { e: args.e } + } +} + +impl __sdk::InModule for InsertVecEnumWithPayloadArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_vec_enum_with_payload { impl insert_vec_enum_with_payload for super::RemoteReducers { fn insert_vec_enum_with_payload(&self, e: Vec) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_vec_enum_with_payload", InsertVecEnumWithPayload { e }) + .call_reducer("insert_vec_enum_with_payload", InsertVecEnumWithPayloadArgs { e }) } fn on_insert_vec_enum_with_payload( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEnumWithPayloadCallbackId { - InsertVecEnumWithPayloadCallbackId(self.imp.on_reducer::( + InsertVecEnumWithPayloadCallbackId(self.imp.on_reducer( "insert_vec_enum_with_payload", - Box::new(move |ctx: &super::EventContext, args: &InsertVecEnumWithPayload| callback(ctx, &args.e)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecEnumWithPayload { e }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, e) + }), )) } fn remove_on_insert_vec_enum_with_payload(&self, callback: InsertVecEnumWithPayloadCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_enum_with_payload", callback.0) + self.imp.remove_on_reducer("insert_vec_enum_with_payload", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs index c69ad4109a..873e2b4973 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs @@ -11,11 +11,17 @@ use super::every_primitive_struct_type::EveryPrimitiveStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecEveryPrimitiveStruct { +pub(super) struct InsertVecEveryPrimitiveStructArgs { pub s: Vec, } -impl __sdk::InModule for InsertVecEveryPrimitiveStruct { +impl From for super::Reducer { + fn from(args: InsertVecEveryPrimitiveStructArgs) -> Self { + Self::InsertVecEveryPrimitiveStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertVecEveryPrimitiveStructArgs { type Module = super::RemoteModule; } @@ -53,21 +59,36 @@ pub trait insert_vec_every_primitive_struct { impl insert_vec_every_primitive_struct for super::RemoteReducers { fn insert_vec_every_primitive_struct(&self, s: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_every_primitive_struct", InsertVecEveryPrimitiveStruct { s }) + self.imp.call_reducer( + "insert_vec_every_primitive_struct", + InsertVecEveryPrimitiveStructArgs { s }, + ) } fn on_insert_vec_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEveryPrimitiveStructCallbackId { - InsertVecEveryPrimitiveStructCallbackId(self.imp.on_reducer::( + InsertVecEveryPrimitiveStructCallbackId(self.imp.on_reducer( "insert_vec_every_primitive_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertVecEveryPrimitiveStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecEveryPrimitiveStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_vec_every_primitive_struct(&self, callback: InsertVecEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_vec_every_primitive_struct", callback.0) + .remove_on_reducer("insert_vec_every_primitive_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs index 5df9e874f6..db8906df8a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs @@ -11,11 +11,17 @@ use super::every_vec_struct_type::EveryVecStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecEveryVecStruct { +pub(super) struct InsertVecEveryVecStructArgs { pub s: Vec, } -impl __sdk::InModule for InsertVecEveryVecStruct { +impl From for super::Reducer { + fn from(args: InsertVecEveryVecStructArgs) -> Self { + Self::InsertVecEveryVecStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertVecEveryVecStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_vec_every_vec_struct { impl insert_vec_every_vec_struct for super::RemoteReducers { fn insert_vec_every_vec_struct(&self, s: Vec) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_vec_every_vec_struct", InsertVecEveryVecStruct { s }) + .call_reducer("insert_vec_every_vec_struct", InsertVecEveryVecStructArgs { s }) } fn on_insert_vec_every_vec_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEveryVecStructCallbackId { - InsertVecEveryVecStructCallbackId(self.imp.on_reducer::( + InsertVecEveryVecStructCallbackId(self.imp.on_reducer( "insert_vec_every_vec_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertVecEveryVecStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecEveryVecStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_vec_every_vec_struct(&self, callback: InsertVecEveryVecStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_every_vec_struct", callback.0) + self.imp.remove_on_reducer("insert_vec_every_vec_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs index 335b3bf319..c8ed6a7934 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecF32 { +pub(super) struct InsertVecF32Args { pub f: Vec, } -impl __sdk::InModule for InsertVecF32 { +impl From for super::Reducer { + fn from(args: InsertVecF32Args) -> Self { + Self::InsertVecF32 { f: args.f } + } +} + +impl __sdk::InModule for InsertVecF32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_f_32 { impl insert_vec_f_32 for super::RemoteReducers { fn insert_vec_f_32(&self, f: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_f32", InsertVecF32 { f }) + self.imp.call_reducer("insert_vec_f32", InsertVecF32Args { f }) } fn on_insert_vec_f_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecF32CallbackId { - InsertVecF32CallbackId(self.imp.on_reducer::( + InsertVecF32CallbackId(self.imp.on_reducer( "insert_vec_f32", - Box::new(move |ctx: &super::EventContext, args: &InsertVecF32| callback(ctx, &args.f)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecF32 { f }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, f) + }), )) } fn remove_on_insert_vec_f_32(&self, callback: InsertVecF32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_f32", callback.0) + self.imp.remove_on_reducer("insert_vec_f32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs index 7273275912..4c5af75c89 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecF64 { +pub(super) struct InsertVecF64Args { pub f: Vec, } -impl __sdk::InModule for InsertVecF64 { +impl From for super::Reducer { + fn from(args: InsertVecF64Args) -> Self { + Self::InsertVecF64 { f: args.f } + } +} + +impl __sdk::InModule for InsertVecF64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_f_64 { impl insert_vec_f_64 for super::RemoteReducers { fn insert_vec_f_64(&self, f: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_f64", InsertVecF64 { f }) + self.imp.call_reducer("insert_vec_f64", InsertVecF64Args { f }) } fn on_insert_vec_f_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecF64CallbackId { - InsertVecF64CallbackId(self.imp.on_reducer::( + InsertVecF64CallbackId(self.imp.on_reducer( "insert_vec_f64", - Box::new(move |ctx: &super::EventContext, args: &InsertVecF64| callback(ctx, &args.f)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecF64 { f }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, f) + }), )) } fn remove_on_insert_vec_f_64(&self, callback: InsertVecF64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_f64", callback.0) + self.imp.remove_on_reducer("insert_vec_f64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs index 046ef45749..a04d1a52e3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI128 { +pub(super) struct InsertVecI128Args { pub n: Vec, } -impl __sdk::InModule for InsertVecI128 { +impl From for super::Reducer { + fn from(args: InsertVecI128Args) -> Self { + Self::InsertVecI128 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_i_128 { impl insert_vec_i_128 for super::RemoteReducers { fn insert_vec_i_128(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i128", InsertVecI128 { n }) + self.imp.call_reducer("insert_vec_i128", InsertVecI128Args { n }) } fn on_insert_vec_i_128( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI128CallbackId { - InsertVecI128CallbackId(self.imp.on_reducer::( + InsertVecI128CallbackId(self.imp.on_reducer( "insert_vec_i128", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_128(&self, callback: InsertVecI128CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_i128", callback.0) + self.imp.remove_on_reducer("insert_vec_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs index bdaea3325d..8169aca35f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI16 { +pub(super) struct InsertVecI16Args { pub n: Vec, } -impl __sdk::InModule for InsertVecI16 { +impl From for super::Reducer { + fn from(args: InsertVecI16Args) -> Self { + Self::InsertVecI16 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_i_16 { impl insert_vec_i_16 for super::RemoteReducers { fn insert_vec_i_16(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i16", InsertVecI16 { n }) + self.imp.call_reducer("insert_vec_i16", InsertVecI16Args { n }) } fn on_insert_vec_i_16( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI16CallbackId { - InsertVecI16CallbackId(self.imp.on_reducer::( + InsertVecI16CallbackId(self.imp.on_reducer( "insert_vec_i16", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_16(&self, callback: InsertVecI16CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i16", callback.0) + self.imp.remove_on_reducer("insert_vec_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs index 5cc1983158..209993ee6d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI256 { +pub(super) struct InsertVecI256Args { pub n: Vec<__sats::i256>, } -impl __sdk::InModule for InsertVecI256 { +impl From for super::Reducer { + fn from(args: InsertVecI256Args) -> Self { + Self::InsertVecI256 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_i_256 { impl insert_vec_i_256 for super::RemoteReducers { fn insert_vec_i_256(&self, n: Vec<__sats::i256>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i256", InsertVecI256 { n }) + self.imp.call_reducer("insert_vec_i256", InsertVecI256Args { n }) } fn on_insert_vec_i_256( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sats::i256>) + Send + 'static, ) -> InsertVecI256CallbackId { - InsertVecI256CallbackId(self.imp.on_reducer::( + InsertVecI256CallbackId(self.imp.on_reducer( "insert_vec_i256", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_256(&self, callback: InsertVecI256CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_i256", callback.0) + self.imp.remove_on_reducer("insert_vec_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs index b58b6c11b8..2449351873 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI32 { +pub(super) struct InsertVecI32Args { pub n: Vec, } -impl __sdk::InModule for InsertVecI32 { +impl From for super::Reducer { + fn from(args: InsertVecI32Args) -> Self { + Self::InsertVecI32 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_i_32 { impl insert_vec_i_32 for super::RemoteReducers { fn insert_vec_i_32(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i32", InsertVecI32 { n }) + self.imp.call_reducer("insert_vec_i32", InsertVecI32Args { n }) } fn on_insert_vec_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI32CallbackId { - InsertVecI32CallbackId(self.imp.on_reducer::( + InsertVecI32CallbackId(self.imp.on_reducer( "insert_vec_i32", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_32(&self, callback: InsertVecI32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i32", callback.0) + self.imp.remove_on_reducer("insert_vec_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs index a4b083e649..dfffc9bdb7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI64 { +pub(super) struct InsertVecI64Args { pub n: Vec, } -impl __sdk::InModule for InsertVecI64 { +impl From for super::Reducer { + fn from(args: InsertVecI64Args) -> Self { + Self::InsertVecI64 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_i_64 { impl insert_vec_i_64 for super::RemoteReducers { fn insert_vec_i_64(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i64", InsertVecI64 { n }) + self.imp.call_reducer("insert_vec_i64", InsertVecI64Args { n }) } fn on_insert_vec_i_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI64CallbackId { - InsertVecI64CallbackId(self.imp.on_reducer::( + InsertVecI64CallbackId(self.imp.on_reducer( "insert_vec_i64", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_64(&self, callback: InsertVecI64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i64", callback.0) + self.imp.remove_on_reducer("insert_vec_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs index 0f044318af..d3761b706c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecI8 { +pub(super) struct InsertVecI8Args { pub n: Vec, } -impl __sdk::InModule for InsertVecI8 { +impl From for super::Reducer { + fn from(args: InsertVecI8Args) -> Self { + Self::InsertVecI8 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecI8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_i_8 { impl insert_vec_i_8 for super::RemoteReducers { fn insert_vec_i_8(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i8", InsertVecI8 { n }) + self.imp.call_reducer("insert_vec_i8", InsertVecI8Args { n }) } fn on_insert_vec_i_8( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI8CallbackId { - InsertVecI8CallbackId(self.imp.on_reducer::( + InsertVecI8CallbackId(self.imp.on_reducer( "insert_vec_i8", - Box::new(move |ctx: &super::EventContext, args: &InsertVecI8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecI8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_i_8(&self, callback: InsertVecI8CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i8", callback.0) + self.imp.remove_on_reducer("insert_vec_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs index d4c128655e..a0e92be987 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecIdentity { +pub(super) struct InsertVecIdentityArgs { pub i: Vec<__sdk::Identity>, } -impl __sdk::InModule for InsertVecIdentity { +impl From for super::Reducer { + fn from(args: InsertVecIdentityArgs) -> Self { + Self::InsertVecIdentity { i: args.i } + } +} + +impl __sdk::InModule for InsertVecIdentityArgs { type Module = super::RemoteModule; } @@ -51,20 +57,33 @@ pub trait insert_vec_identity { impl insert_vec_identity for super::RemoteReducers { fn insert_vec_identity(&self, i: Vec<__sdk::Identity>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_identity", InsertVecIdentity { i }) + self.imp + .call_reducer("insert_vec_identity", InsertVecIdentityArgs { i }) } fn on_insert_vec_identity( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sdk::Identity>) + Send + 'static, ) -> InsertVecIdentityCallbackId { - InsertVecIdentityCallbackId(self.imp.on_reducer::( + InsertVecIdentityCallbackId(self.imp.on_reducer( "insert_vec_identity", - Box::new(move |ctx: &super::EventContext, args: &InsertVecIdentity| callback(ctx, &args.i)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecIdentity { i }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i) + }), )) } fn remove_on_insert_vec_identity(&self, callback: InsertVecIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_identity", callback.0) + self.imp.remove_on_reducer("insert_vec_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs index 7f8eb61db3..13aeeb7cff 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs @@ -11,11 +11,17 @@ use super::simple_enum_type::SimpleEnum; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecSimpleEnum { +pub(super) struct InsertVecSimpleEnumArgs { pub e: Vec, } -impl __sdk::InModule for InsertVecSimpleEnum { +impl From for super::Reducer { + fn from(args: InsertVecSimpleEnumArgs) -> Self { + Self::InsertVecSimpleEnum { e: args.e } + } +} + +impl __sdk::InModule for InsertVecSimpleEnumArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_vec_simple_enum { impl insert_vec_simple_enum for super::RemoteReducers { fn insert_vec_simple_enum(&self, e: Vec) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_vec_simple_enum", InsertVecSimpleEnum { e }) + .call_reducer("insert_vec_simple_enum", InsertVecSimpleEnumArgs { e }) } fn on_insert_vec_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecSimpleEnumCallbackId { - InsertVecSimpleEnumCallbackId(self.imp.on_reducer::( + InsertVecSimpleEnumCallbackId(self.imp.on_reducer( "insert_vec_simple_enum", - Box::new(move |ctx: &super::EventContext, args: &InsertVecSimpleEnum| callback(ctx, &args.e)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecSimpleEnum { e }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, e) + }), )) } fn remove_on_insert_vec_simple_enum(&self, callback: InsertVecSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_simple_enum", callback.0) + self.imp.remove_on_reducer("insert_vec_simple_enum", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs index d0171db604..09568f9f20 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecString { +pub(super) struct InsertVecStringArgs { pub s: Vec, } -impl __sdk::InModule for InsertVecString { +impl From for super::Reducer { + fn from(args: InsertVecStringArgs) -> Self { + Self::InsertVecString { s: args.s } + } +} + +impl __sdk::InModule for InsertVecStringArgs { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_string { impl insert_vec_string for super::RemoteReducers { fn insert_vec_string(&self, s: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_string", InsertVecString { s }) + self.imp.call_reducer("insert_vec_string", InsertVecStringArgs { s }) } fn on_insert_vec_string( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecStringCallbackId { - InsertVecStringCallbackId(self.imp.on_reducer::( + InsertVecStringCallbackId(self.imp.on_reducer( "insert_vec_string", - Box::new(move |ctx: &super::EventContext, args: &InsertVecString| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecString { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_vec_string(&self, callback: InsertVecStringCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_string", callback.0) + self.imp.remove_on_reducer("insert_vec_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs index 0c7441db0b..67e144a38b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU128 { +pub(super) struct InsertVecU128Args { pub n: Vec, } -impl __sdk::InModule for InsertVecU128 { +impl From for super::Reducer { + fn from(args: InsertVecU128Args) -> Self { + Self::InsertVecU128 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU128Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_u_128 { impl insert_vec_u_128 for super::RemoteReducers { fn insert_vec_u_128(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u128", InsertVecU128 { n }) + self.imp.call_reducer("insert_vec_u128", InsertVecU128Args { n }) } fn on_insert_vec_u_128( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU128CallbackId { - InsertVecU128CallbackId(self.imp.on_reducer::( + InsertVecU128CallbackId(self.imp.on_reducer( "insert_vec_u128", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU128| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU128 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_128(&self, callback: InsertVecU128CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_u128", callback.0) + self.imp.remove_on_reducer("insert_vec_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs index 0c3a9dceea..e9ebdba5f3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU16 { +pub(super) struct InsertVecU16Args { pub n: Vec, } -impl __sdk::InModule for InsertVecU16 { +impl From for super::Reducer { + fn from(args: InsertVecU16Args) -> Self { + Self::InsertVecU16 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU16Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_u_16 { impl insert_vec_u_16 for super::RemoteReducers { fn insert_vec_u_16(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u16", InsertVecU16 { n }) + self.imp.call_reducer("insert_vec_u16", InsertVecU16Args { n }) } fn on_insert_vec_u_16( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU16CallbackId { - InsertVecU16CallbackId(self.imp.on_reducer::( + InsertVecU16CallbackId(self.imp.on_reducer( "insert_vec_u16", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU16| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU16 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_16(&self, callback: InsertVecU16CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u16", callback.0) + self.imp.remove_on_reducer("insert_vec_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs index 178e01a6af..da23080902 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU256 { +pub(super) struct InsertVecU256Args { pub n: Vec<__sats::u256>, } -impl __sdk::InModule for InsertVecU256 { +impl From for super::Reducer { + fn from(args: InsertVecU256Args) -> Self { + Self::InsertVecU256 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU256Args { type Module = super::RemoteModule; } @@ -51,20 +57,32 @@ pub trait insert_vec_u_256 { impl insert_vec_u_256 for super::RemoteReducers { fn insert_vec_u_256(&self, n: Vec<__sats::u256>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u256", InsertVecU256 { n }) + self.imp.call_reducer("insert_vec_u256", InsertVecU256Args { n }) } fn on_insert_vec_u_256( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sats::u256>) + Send + 'static, ) -> InsertVecU256CallbackId { - InsertVecU256CallbackId(self.imp.on_reducer::( + InsertVecU256CallbackId(self.imp.on_reducer( "insert_vec_u256", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU256| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU256 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_256(&self, callback: InsertVecU256CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_u256", callback.0) + self.imp.remove_on_reducer("insert_vec_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs index 834abda58f..747cfa50ef 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU32 { +pub(super) struct InsertVecU32Args { pub n: Vec, } -impl __sdk::InModule for InsertVecU32 { +impl From for super::Reducer { + fn from(args: InsertVecU32Args) -> Self { + Self::InsertVecU32 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU32Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_u_32 { impl insert_vec_u_32 for super::RemoteReducers { fn insert_vec_u_32(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u32", InsertVecU32 { n }) + self.imp.call_reducer("insert_vec_u32", InsertVecU32Args { n }) } fn on_insert_vec_u_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU32CallbackId { - InsertVecU32CallbackId(self.imp.on_reducer::( + InsertVecU32CallbackId(self.imp.on_reducer( "insert_vec_u32", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU32| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU32 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_32(&self, callback: InsertVecU32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u32", callback.0) + self.imp.remove_on_reducer("insert_vec_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs index 34441d88ce..05fb5c98cd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU64 { +pub(super) struct InsertVecU64Args { pub n: Vec, } -impl __sdk::InModule for InsertVecU64 { +impl From for super::Reducer { + fn from(args: InsertVecU64Args) -> Self { + Self::InsertVecU64 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU64Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_u_64 { impl insert_vec_u_64 for super::RemoteReducers { fn insert_vec_u_64(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u64", InsertVecU64 { n }) + self.imp.call_reducer("insert_vec_u64", InsertVecU64Args { n }) } fn on_insert_vec_u_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU64CallbackId { - InsertVecU64CallbackId(self.imp.on_reducer::( + InsertVecU64CallbackId(self.imp.on_reducer( "insert_vec_u64", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU64| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU64 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_64(&self, callback: InsertVecU64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u64", callback.0) + self.imp.remove_on_reducer("insert_vec_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs index c8c1e1ae5e..e2ddf415da 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs @@ -9,11 +9,17 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecU8 { +pub(super) struct InsertVecU8Args { pub n: Vec, } -impl __sdk::InModule for InsertVecU8 { +impl From for super::Reducer { + fn from(args: InsertVecU8Args) -> Self { + Self::InsertVecU8 { n: args.n } + } +} + +impl __sdk::InModule for InsertVecU8Args { type Module = super::RemoteModule; } @@ -51,19 +57,32 @@ pub trait insert_vec_u_8 { impl insert_vec_u_8 for super::RemoteReducers { fn insert_vec_u_8(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u8", InsertVecU8 { n }) + self.imp.call_reducer("insert_vec_u8", InsertVecU8Args { n }) } fn on_insert_vec_u_8( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU8CallbackId { - InsertVecU8CallbackId(self.imp.on_reducer::( + InsertVecU8CallbackId(self.imp.on_reducer( "insert_vec_u8", - Box::new(move |ctx: &super::EventContext, args: &InsertVecU8| callback(ctx, &args.n)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecU8 { n }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n) + }), )) } fn remove_on_insert_vec_u_8(&self, callback: InsertVecU8CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u8", callback.0) + self.imp.remove_on_reducer("insert_vec_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs index 27299d4252..8c3bf8a7d7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs @@ -11,11 +11,17 @@ use super::unit_struct_type::UnitStruct; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct InsertVecUnitStruct { +pub(super) struct InsertVecUnitStructArgs { pub s: Vec, } -impl __sdk::InModule for InsertVecUnitStruct { +impl From for super::Reducer { + fn from(args: InsertVecUnitStructArgs) -> Self { + Self::InsertVecUnitStruct { s: args.s } + } +} + +impl __sdk::InModule for InsertVecUnitStructArgs { type Module = super::RemoteModule; } @@ -54,20 +60,32 @@ pub trait insert_vec_unit_struct { impl insert_vec_unit_struct for super::RemoteReducers { fn insert_vec_unit_struct(&self, s: Vec) -> __anyhow::Result<()> { self.imp - .call_reducer("insert_vec_unit_struct", InsertVecUnitStruct { s }) + .call_reducer("insert_vec_unit_struct", InsertVecUnitStructArgs { s }) } fn on_insert_vec_unit_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecUnitStructCallbackId { - InsertVecUnitStructCallbackId(self.imp.on_reducer::( + InsertVecUnitStructCallbackId(self.imp.on_reducer( "insert_vec_unit_struct", - Box::new(move |ctx: &super::EventContext, args: &InsertVecUnitStruct| callback(ctx, &args.s)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::InsertVecUnitStruct { s }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s) + }), )) } fn remove_on_insert_vec_unit_struct(&self, callback: InsertVecUnitStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_unit_struct", callback.0) + self.imp.remove_on_reducer("insert_vec_unit_struct", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/mod.rs b/crates/sdk/tests/test-client/src/module_bindings/mod.rs index 5b4b76550d..e048a98bbe 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/mod.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/mod.rs @@ -352,353 +352,473 @@ pub mod vec_u_8_type; pub mod vec_unit_struct_table; pub mod vec_unit_struct_type; -pub use byte_struct_type::*; -pub use delete_pk_address_reducer::*; -pub use delete_pk_bool_reducer::*; -pub use delete_pk_i_128_reducer::*; -pub use delete_pk_i_16_reducer::*; -pub use delete_pk_i_256_reducer::*; -pub use delete_pk_i_32_reducer::*; -pub use delete_pk_i_64_reducer::*; -pub use delete_pk_i_8_reducer::*; -pub use delete_pk_identity_reducer::*; -pub use delete_pk_string_reducer::*; -pub use delete_pk_u_128_reducer::*; -pub use delete_pk_u_16_reducer::*; -pub use delete_pk_u_256_reducer::*; -pub use delete_pk_u_32_reducer::*; -pub use delete_pk_u_64_reducer::*; -pub use delete_pk_u_8_reducer::*; -pub use delete_unique_address_reducer::*; -pub use delete_unique_bool_reducer::*; -pub use delete_unique_i_128_reducer::*; -pub use delete_unique_i_16_reducer::*; -pub use delete_unique_i_256_reducer::*; -pub use delete_unique_i_32_reducer::*; -pub use delete_unique_i_64_reducer::*; -pub use delete_unique_i_8_reducer::*; -pub use delete_unique_identity_reducer::*; -pub use delete_unique_string_reducer::*; -pub use delete_unique_u_128_reducer::*; -pub use delete_unique_u_16_reducer::*; -pub use delete_unique_u_256_reducer::*; -pub use delete_unique_u_32_reducer::*; -pub use delete_unique_u_64_reducer::*; -pub use delete_unique_u_8_reducer::*; -pub use enum_with_payload_type::*; -pub use every_primitive_struct_type::*; -pub use every_vec_struct_type::*; -pub use insert_caller_one_address_reducer::*; -pub use insert_caller_one_identity_reducer::*; -pub use insert_caller_pk_address_reducer::*; -pub use insert_caller_pk_identity_reducer::*; -pub use insert_caller_unique_address_reducer::*; -pub use insert_caller_unique_identity_reducer::*; -pub use insert_caller_vec_address_reducer::*; -pub use insert_caller_vec_identity_reducer::*; -pub use insert_large_table_reducer::*; -pub use insert_one_address_reducer::*; -pub use insert_one_bool_reducer::*; -pub use insert_one_byte_struct_reducer::*; -pub use insert_one_enum_with_payload_reducer::*; -pub use insert_one_every_primitive_struct_reducer::*; -pub use insert_one_every_vec_struct_reducer::*; -pub use insert_one_f_32_reducer::*; -pub use insert_one_f_64_reducer::*; -pub use insert_one_i_128_reducer::*; -pub use insert_one_i_16_reducer::*; -pub use insert_one_i_256_reducer::*; -pub use insert_one_i_32_reducer::*; -pub use insert_one_i_64_reducer::*; -pub use insert_one_i_8_reducer::*; -pub use insert_one_identity_reducer::*; -pub use insert_one_simple_enum_reducer::*; -pub use insert_one_string_reducer::*; -pub use insert_one_u_128_reducer::*; -pub use insert_one_u_16_reducer::*; -pub use insert_one_u_256_reducer::*; -pub use insert_one_u_32_reducer::*; -pub use insert_one_u_64_reducer::*; -pub use insert_one_u_8_reducer::*; -pub use insert_one_unit_struct_reducer::*; -pub use insert_option_every_primitive_struct_reducer::*; -pub use insert_option_i_32_reducer::*; -pub use insert_option_identity_reducer::*; -pub use insert_option_simple_enum_reducer::*; -pub use insert_option_string_reducer::*; -pub use insert_option_vec_option_i_32_reducer::*; -pub use insert_pk_address_reducer::*; -pub use insert_pk_bool_reducer::*; -pub use insert_pk_i_128_reducer::*; -pub use insert_pk_i_16_reducer::*; -pub use insert_pk_i_256_reducer::*; -pub use insert_pk_i_32_reducer::*; -pub use insert_pk_i_64_reducer::*; -pub use insert_pk_i_8_reducer::*; -pub use insert_pk_identity_reducer::*; -pub use insert_pk_string_reducer::*; -pub use insert_pk_u_128_reducer::*; -pub use insert_pk_u_16_reducer::*; -pub use insert_pk_u_256_reducer::*; -pub use insert_pk_u_32_reducer::*; -pub use insert_pk_u_64_reducer::*; -pub use insert_pk_u_8_reducer::*; -pub use insert_primitives_as_strings_reducer::*; -pub use insert_table_holds_table_reducer::*; -pub use insert_unique_address_reducer::*; -pub use insert_unique_bool_reducer::*; -pub use insert_unique_i_128_reducer::*; -pub use insert_unique_i_16_reducer::*; -pub use insert_unique_i_256_reducer::*; -pub use insert_unique_i_32_reducer::*; -pub use insert_unique_i_64_reducer::*; -pub use insert_unique_i_8_reducer::*; -pub use insert_unique_identity_reducer::*; -pub use insert_unique_string_reducer::*; -pub use insert_unique_u_128_reducer::*; -pub use insert_unique_u_16_reducer::*; -pub use insert_unique_u_256_reducer::*; -pub use insert_unique_u_32_reducer::*; -pub use insert_unique_u_64_reducer::*; -pub use insert_unique_u_8_reducer::*; -pub use insert_vec_address_reducer::*; -pub use insert_vec_bool_reducer::*; -pub use insert_vec_byte_struct_reducer::*; -pub use insert_vec_enum_with_payload_reducer::*; -pub use insert_vec_every_primitive_struct_reducer::*; -pub use insert_vec_every_vec_struct_reducer::*; -pub use insert_vec_f_32_reducer::*; -pub use insert_vec_f_64_reducer::*; -pub use insert_vec_i_128_reducer::*; -pub use insert_vec_i_16_reducer::*; -pub use insert_vec_i_256_reducer::*; -pub use insert_vec_i_32_reducer::*; -pub use insert_vec_i_64_reducer::*; -pub use insert_vec_i_8_reducer::*; -pub use insert_vec_identity_reducer::*; -pub use insert_vec_simple_enum_reducer::*; -pub use insert_vec_string_reducer::*; -pub use insert_vec_u_128_reducer::*; -pub use insert_vec_u_16_reducer::*; -pub use insert_vec_u_256_reducer::*; -pub use insert_vec_u_32_reducer::*; -pub use insert_vec_u_64_reducer::*; -pub use insert_vec_u_8_reducer::*; -pub use insert_vec_unit_struct_reducer::*; +pub use byte_struct_type::ByteStruct; +pub use delete_pk_address_reducer::{delete_pk_address, set_flags_for_delete_pk_address, DeletePkAddressCallbackId}; +pub use delete_pk_bool_reducer::{delete_pk_bool, set_flags_for_delete_pk_bool, DeletePkBoolCallbackId}; +pub use delete_pk_i_128_reducer::{delete_pk_i_128, set_flags_for_delete_pk_i_128, DeletePkI128CallbackId}; +pub use delete_pk_i_16_reducer::{delete_pk_i_16, set_flags_for_delete_pk_i_16, DeletePkI16CallbackId}; +pub use delete_pk_i_256_reducer::{delete_pk_i_256, set_flags_for_delete_pk_i_256, DeletePkI256CallbackId}; +pub use delete_pk_i_32_reducer::{delete_pk_i_32, set_flags_for_delete_pk_i_32, DeletePkI32CallbackId}; +pub use delete_pk_i_64_reducer::{delete_pk_i_64, set_flags_for_delete_pk_i_64, DeletePkI64CallbackId}; +pub use delete_pk_i_8_reducer::{delete_pk_i_8, set_flags_for_delete_pk_i_8, DeletePkI8CallbackId}; +pub use delete_pk_identity_reducer::{ + delete_pk_identity, set_flags_for_delete_pk_identity, DeletePkIdentityCallbackId, +}; +pub use delete_pk_string_reducer::{delete_pk_string, set_flags_for_delete_pk_string, DeletePkStringCallbackId}; +pub use delete_pk_u_128_reducer::{delete_pk_u_128, set_flags_for_delete_pk_u_128, DeletePkU128CallbackId}; +pub use delete_pk_u_16_reducer::{delete_pk_u_16, set_flags_for_delete_pk_u_16, DeletePkU16CallbackId}; +pub use delete_pk_u_256_reducer::{delete_pk_u_256, set_flags_for_delete_pk_u_256, DeletePkU256CallbackId}; +pub use delete_pk_u_32_reducer::{delete_pk_u_32, set_flags_for_delete_pk_u_32, DeletePkU32CallbackId}; +pub use delete_pk_u_64_reducer::{delete_pk_u_64, set_flags_for_delete_pk_u_64, DeletePkU64CallbackId}; +pub use delete_pk_u_8_reducer::{delete_pk_u_8, set_flags_for_delete_pk_u_8, DeletePkU8CallbackId}; +pub use delete_unique_address_reducer::{ + delete_unique_address, set_flags_for_delete_unique_address, DeleteUniqueAddressCallbackId, +}; +pub use delete_unique_bool_reducer::{ + delete_unique_bool, set_flags_for_delete_unique_bool, DeleteUniqueBoolCallbackId, +}; +pub use delete_unique_i_128_reducer::{ + delete_unique_i_128, set_flags_for_delete_unique_i_128, DeleteUniqueI128CallbackId, +}; +pub use delete_unique_i_16_reducer::{delete_unique_i_16, set_flags_for_delete_unique_i_16, DeleteUniqueI16CallbackId}; +pub use delete_unique_i_256_reducer::{ + delete_unique_i_256, set_flags_for_delete_unique_i_256, DeleteUniqueI256CallbackId, +}; +pub use delete_unique_i_32_reducer::{delete_unique_i_32, set_flags_for_delete_unique_i_32, DeleteUniqueI32CallbackId}; +pub use delete_unique_i_64_reducer::{delete_unique_i_64, set_flags_for_delete_unique_i_64, DeleteUniqueI64CallbackId}; +pub use delete_unique_i_8_reducer::{delete_unique_i_8, set_flags_for_delete_unique_i_8, DeleteUniqueI8CallbackId}; +pub use delete_unique_identity_reducer::{ + delete_unique_identity, set_flags_for_delete_unique_identity, DeleteUniqueIdentityCallbackId, +}; +pub use delete_unique_string_reducer::{ + delete_unique_string, set_flags_for_delete_unique_string, DeleteUniqueStringCallbackId, +}; +pub use delete_unique_u_128_reducer::{ + delete_unique_u_128, set_flags_for_delete_unique_u_128, DeleteUniqueU128CallbackId, +}; +pub use delete_unique_u_16_reducer::{delete_unique_u_16, set_flags_for_delete_unique_u_16, DeleteUniqueU16CallbackId}; +pub use delete_unique_u_256_reducer::{ + delete_unique_u_256, set_flags_for_delete_unique_u_256, DeleteUniqueU256CallbackId, +}; +pub use delete_unique_u_32_reducer::{delete_unique_u_32, set_flags_for_delete_unique_u_32, DeleteUniqueU32CallbackId}; +pub use delete_unique_u_64_reducer::{delete_unique_u_64, set_flags_for_delete_unique_u_64, DeleteUniqueU64CallbackId}; +pub use delete_unique_u_8_reducer::{delete_unique_u_8, set_flags_for_delete_unique_u_8, DeleteUniqueU8CallbackId}; +pub use enum_with_payload_type::EnumWithPayload; +pub use every_primitive_struct_type::EveryPrimitiveStruct; +pub use every_vec_struct_type::EveryVecStruct; +pub use insert_caller_one_address_reducer::{ + insert_caller_one_address, set_flags_for_insert_caller_one_address, InsertCallerOneAddressCallbackId, +}; +pub use insert_caller_one_identity_reducer::{ + insert_caller_one_identity, set_flags_for_insert_caller_one_identity, InsertCallerOneIdentityCallbackId, +}; +pub use insert_caller_pk_address_reducer::{ + insert_caller_pk_address, set_flags_for_insert_caller_pk_address, InsertCallerPkAddressCallbackId, +}; +pub use insert_caller_pk_identity_reducer::{ + insert_caller_pk_identity, set_flags_for_insert_caller_pk_identity, InsertCallerPkIdentityCallbackId, +}; +pub use insert_caller_unique_address_reducer::{ + insert_caller_unique_address, set_flags_for_insert_caller_unique_address, InsertCallerUniqueAddressCallbackId, +}; +pub use insert_caller_unique_identity_reducer::{ + insert_caller_unique_identity, set_flags_for_insert_caller_unique_identity, InsertCallerUniqueIdentityCallbackId, +}; +pub use insert_caller_vec_address_reducer::{ + insert_caller_vec_address, set_flags_for_insert_caller_vec_address, InsertCallerVecAddressCallbackId, +}; +pub use insert_caller_vec_identity_reducer::{ + insert_caller_vec_identity, set_flags_for_insert_caller_vec_identity, InsertCallerVecIdentityCallbackId, +}; +pub use insert_large_table_reducer::{ + insert_large_table, set_flags_for_insert_large_table, InsertLargeTableCallbackId, +}; +pub use insert_one_address_reducer::{ + insert_one_address, set_flags_for_insert_one_address, InsertOneAddressCallbackId, +}; +pub use insert_one_bool_reducer::{insert_one_bool, set_flags_for_insert_one_bool, InsertOneBoolCallbackId}; +pub use insert_one_byte_struct_reducer::{ + insert_one_byte_struct, set_flags_for_insert_one_byte_struct, InsertOneByteStructCallbackId, +}; +pub use insert_one_enum_with_payload_reducer::{ + insert_one_enum_with_payload, set_flags_for_insert_one_enum_with_payload, InsertOneEnumWithPayloadCallbackId, +}; +pub use insert_one_every_primitive_struct_reducer::{ + insert_one_every_primitive_struct, set_flags_for_insert_one_every_primitive_struct, + InsertOneEveryPrimitiveStructCallbackId, +}; +pub use insert_one_every_vec_struct_reducer::{ + insert_one_every_vec_struct, set_flags_for_insert_one_every_vec_struct, InsertOneEveryVecStructCallbackId, +}; +pub use insert_one_f_32_reducer::{insert_one_f_32, set_flags_for_insert_one_f_32, InsertOneF32CallbackId}; +pub use insert_one_f_64_reducer::{insert_one_f_64, set_flags_for_insert_one_f_64, InsertOneF64CallbackId}; +pub use insert_one_i_128_reducer::{insert_one_i_128, set_flags_for_insert_one_i_128, InsertOneI128CallbackId}; +pub use insert_one_i_16_reducer::{insert_one_i_16, set_flags_for_insert_one_i_16, InsertOneI16CallbackId}; +pub use insert_one_i_256_reducer::{insert_one_i_256, set_flags_for_insert_one_i_256, InsertOneI256CallbackId}; +pub use insert_one_i_32_reducer::{insert_one_i_32, set_flags_for_insert_one_i_32, InsertOneI32CallbackId}; +pub use insert_one_i_64_reducer::{insert_one_i_64, set_flags_for_insert_one_i_64, InsertOneI64CallbackId}; +pub use insert_one_i_8_reducer::{insert_one_i_8, set_flags_for_insert_one_i_8, InsertOneI8CallbackId}; +pub use insert_one_identity_reducer::{ + insert_one_identity, set_flags_for_insert_one_identity, InsertOneIdentityCallbackId, +}; +pub use insert_one_simple_enum_reducer::{ + insert_one_simple_enum, set_flags_for_insert_one_simple_enum, InsertOneSimpleEnumCallbackId, +}; +pub use insert_one_string_reducer::{insert_one_string, set_flags_for_insert_one_string, InsertOneStringCallbackId}; +pub use insert_one_u_128_reducer::{insert_one_u_128, set_flags_for_insert_one_u_128, InsertOneU128CallbackId}; +pub use insert_one_u_16_reducer::{insert_one_u_16, set_flags_for_insert_one_u_16, InsertOneU16CallbackId}; +pub use insert_one_u_256_reducer::{insert_one_u_256, set_flags_for_insert_one_u_256, InsertOneU256CallbackId}; +pub use insert_one_u_32_reducer::{insert_one_u_32, set_flags_for_insert_one_u_32, InsertOneU32CallbackId}; +pub use insert_one_u_64_reducer::{insert_one_u_64, set_flags_for_insert_one_u_64, InsertOneU64CallbackId}; +pub use insert_one_u_8_reducer::{insert_one_u_8, set_flags_for_insert_one_u_8, InsertOneU8CallbackId}; +pub use insert_one_unit_struct_reducer::{ + insert_one_unit_struct, set_flags_for_insert_one_unit_struct, InsertOneUnitStructCallbackId, +}; +pub use insert_option_every_primitive_struct_reducer::{ + insert_option_every_primitive_struct, set_flags_for_insert_option_every_primitive_struct, + InsertOptionEveryPrimitiveStructCallbackId, +}; +pub use insert_option_i_32_reducer::{insert_option_i_32, set_flags_for_insert_option_i_32, InsertOptionI32CallbackId}; +pub use insert_option_identity_reducer::{ + insert_option_identity, set_flags_for_insert_option_identity, InsertOptionIdentityCallbackId, +}; +pub use insert_option_simple_enum_reducer::{ + insert_option_simple_enum, set_flags_for_insert_option_simple_enum, InsertOptionSimpleEnumCallbackId, +}; +pub use insert_option_string_reducer::{ + insert_option_string, set_flags_for_insert_option_string, InsertOptionStringCallbackId, +}; +pub use insert_option_vec_option_i_32_reducer::{ + insert_option_vec_option_i_32, set_flags_for_insert_option_vec_option_i_32, InsertOptionVecOptionI32CallbackId, +}; +pub use insert_pk_address_reducer::{insert_pk_address, set_flags_for_insert_pk_address, InsertPkAddressCallbackId}; +pub use insert_pk_bool_reducer::{insert_pk_bool, set_flags_for_insert_pk_bool, InsertPkBoolCallbackId}; +pub use insert_pk_i_128_reducer::{insert_pk_i_128, set_flags_for_insert_pk_i_128, InsertPkI128CallbackId}; +pub use insert_pk_i_16_reducer::{insert_pk_i_16, set_flags_for_insert_pk_i_16, InsertPkI16CallbackId}; +pub use insert_pk_i_256_reducer::{insert_pk_i_256, set_flags_for_insert_pk_i_256, InsertPkI256CallbackId}; +pub use insert_pk_i_32_reducer::{insert_pk_i_32, set_flags_for_insert_pk_i_32, InsertPkI32CallbackId}; +pub use insert_pk_i_64_reducer::{insert_pk_i_64, set_flags_for_insert_pk_i_64, InsertPkI64CallbackId}; +pub use insert_pk_i_8_reducer::{insert_pk_i_8, set_flags_for_insert_pk_i_8, InsertPkI8CallbackId}; +pub use insert_pk_identity_reducer::{ + insert_pk_identity, set_flags_for_insert_pk_identity, InsertPkIdentityCallbackId, +}; +pub use insert_pk_string_reducer::{insert_pk_string, set_flags_for_insert_pk_string, InsertPkStringCallbackId}; +pub use insert_pk_u_128_reducer::{insert_pk_u_128, set_flags_for_insert_pk_u_128, InsertPkU128CallbackId}; +pub use insert_pk_u_16_reducer::{insert_pk_u_16, set_flags_for_insert_pk_u_16, InsertPkU16CallbackId}; +pub use insert_pk_u_256_reducer::{insert_pk_u_256, set_flags_for_insert_pk_u_256, InsertPkU256CallbackId}; +pub use insert_pk_u_32_reducer::{insert_pk_u_32, set_flags_for_insert_pk_u_32, InsertPkU32CallbackId}; +pub use insert_pk_u_64_reducer::{insert_pk_u_64, set_flags_for_insert_pk_u_64, InsertPkU64CallbackId}; +pub use insert_pk_u_8_reducer::{insert_pk_u_8, set_flags_for_insert_pk_u_8, InsertPkU8CallbackId}; +pub use insert_primitives_as_strings_reducer::{ + insert_primitives_as_strings, set_flags_for_insert_primitives_as_strings, InsertPrimitivesAsStringsCallbackId, +}; +pub use insert_table_holds_table_reducer::{ + insert_table_holds_table, set_flags_for_insert_table_holds_table, InsertTableHoldsTableCallbackId, +}; +pub use insert_unique_address_reducer::{ + insert_unique_address, set_flags_for_insert_unique_address, InsertUniqueAddressCallbackId, +}; +pub use insert_unique_bool_reducer::{ + insert_unique_bool, set_flags_for_insert_unique_bool, InsertUniqueBoolCallbackId, +}; +pub use insert_unique_i_128_reducer::{ + insert_unique_i_128, set_flags_for_insert_unique_i_128, InsertUniqueI128CallbackId, +}; +pub use insert_unique_i_16_reducer::{insert_unique_i_16, set_flags_for_insert_unique_i_16, InsertUniqueI16CallbackId}; +pub use insert_unique_i_256_reducer::{ + insert_unique_i_256, set_flags_for_insert_unique_i_256, InsertUniqueI256CallbackId, +}; +pub use insert_unique_i_32_reducer::{insert_unique_i_32, set_flags_for_insert_unique_i_32, InsertUniqueI32CallbackId}; +pub use insert_unique_i_64_reducer::{insert_unique_i_64, set_flags_for_insert_unique_i_64, InsertUniqueI64CallbackId}; +pub use insert_unique_i_8_reducer::{insert_unique_i_8, set_flags_for_insert_unique_i_8, InsertUniqueI8CallbackId}; +pub use insert_unique_identity_reducer::{ + insert_unique_identity, set_flags_for_insert_unique_identity, InsertUniqueIdentityCallbackId, +}; +pub use insert_unique_string_reducer::{ + insert_unique_string, set_flags_for_insert_unique_string, InsertUniqueStringCallbackId, +}; +pub use insert_unique_u_128_reducer::{ + insert_unique_u_128, set_flags_for_insert_unique_u_128, InsertUniqueU128CallbackId, +}; +pub use insert_unique_u_16_reducer::{insert_unique_u_16, set_flags_for_insert_unique_u_16, InsertUniqueU16CallbackId}; +pub use insert_unique_u_256_reducer::{ + insert_unique_u_256, set_flags_for_insert_unique_u_256, InsertUniqueU256CallbackId, +}; +pub use insert_unique_u_32_reducer::{insert_unique_u_32, set_flags_for_insert_unique_u_32, InsertUniqueU32CallbackId}; +pub use insert_unique_u_64_reducer::{insert_unique_u_64, set_flags_for_insert_unique_u_64, InsertUniqueU64CallbackId}; +pub use insert_unique_u_8_reducer::{insert_unique_u_8, set_flags_for_insert_unique_u_8, InsertUniqueU8CallbackId}; +pub use insert_vec_address_reducer::{ + insert_vec_address, set_flags_for_insert_vec_address, InsertVecAddressCallbackId, +}; +pub use insert_vec_bool_reducer::{insert_vec_bool, set_flags_for_insert_vec_bool, InsertVecBoolCallbackId}; +pub use insert_vec_byte_struct_reducer::{ + insert_vec_byte_struct, set_flags_for_insert_vec_byte_struct, InsertVecByteStructCallbackId, +}; +pub use insert_vec_enum_with_payload_reducer::{ + insert_vec_enum_with_payload, set_flags_for_insert_vec_enum_with_payload, InsertVecEnumWithPayloadCallbackId, +}; +pub use insert_vec_every_primitive_struct_reducer::{ + insert_vec_every_primitive_struct, set_flags_for_insert_vec_every_primitive_struct, + InsertVecEveryPrimitiveStructCallbackId, +}; +pub use insert_vec_every_vec_struct_reducer::{ + insert_vec_every_vec_struct, set_flags_for_insert_vec_every_vec_struct, InsertVecEveryVecStructCallbackId, +}; +pub use insert_vec_f_32_reducer::{insert_vec_f_32, set_flags_for_insert_vec_f_32, InsertVecF32CallbackId}; +pub use insert_vec_f_64_reducer::{insert_vec_f_64, set_flags_for_insert_vec_f_64, InsertVecF64CallbackId}; +pub use insert_vec_i_128_reducer::{insert_vec_i_128, set_flags_for_insert_vec_i_128, InsertVecI128CallbackId}; +pub use insert_vec_i_16_reducer::{insert_vec_i_16, set_flags_for_insert_vec_i_16, InsertVecI16CallbackId}; +pub use insert_vec_i_256_reducer::{insert_vec_i_256, set_flags_for_insert_vec_i_256, InsertVecI256CallbackId}; +pub use insert_vec_i_32_reducer::{insert_vec_i_32, set_flags_for_insert_vec_i_32, InsertVecI32CallbackId}; +pub use insert_vec_i_64_reducer::{insert_vec_i_64, set_flags_for_insert_vec_i_64, InsertVecI64CallbackId}; +pub use insert_vec_i_8_reducer::{insert_vec_i_8, set_flags_for_insert_vec_i_8, InsertVecI8CallbackId}; +pub use insert_vec_identity_reducer::{ + insert_vec_identity, set_flags_for_insert_vec_identity, InsertVecIdentityCallbackId, +}; +pub use insert_vec_simple_enum_reducer::{ + insert_vec_simple_enum, set_flags_for_insert_vec_simple_enum, InsertVecSimpleEnumCallbackId, +}; +pub use insert_vec_string_reducer::{insert_vec_string, set_flags_for_insert_vec_string, InsertVecStringCallbackId}; +pub use insert_vec_u_128_reducer::{insert_vec_u_128, set_flags_for_insert_vec_u_128, InsertVecU128CallbackId}; +pub use insert_vec_u_16_reducer::{insert_vec_u_16, set_flags_for_insert_vec_u_16, InsertVecU16CallbackId}; +pub use insert_vec_u_256_reducer::{insert_vec_u_256, set_flags_for_insert_vec_u_256, InsertVecU256CallbackId}; +pub use insert_vec_u_32_reducer::{insert_vec_u_32, set_flags_for_insert_vec_u_32, InsertVecU32CallbackId}; +pub use insert_vec_u_64_reducer::{insert_vec_u_64, set_flags_for_insert_vec_u_64, InsertVecU64CallbackId}; +pub use insert_vec_u_8_reducer::{insert_vec_u_8, set_flags_for_insert_vec_u_8, InsertVecU8CallbackId}; +pub use insert_vec_unit_struct_reducer::{ + insert_vec_unit_struct, set_flags_for_insert_vec_unit_struct, InsertVecUnitStructCallbackId, +}; pub use large_table_table::*; -pub use large_table_type::*; -pub use no_op_succeeds_reducer::*; +pub use large_table_type::LargeTable; +pub use no_op_succeeds_reducer::{no_op_succeeds, set_flags_for_no_op_succeeds, NoOpSucceedsCallbackId}; pub use one_address_table::*; -pub use one_address_type::*; +pub use one_address_type::OneAddress; pub use one_bool_table::*; -pub use one_bool_type::*; +pub use one_bool_type::OneBool; pub use one_byte_struct_table::*; -pub use one_byte_struct_type::*; +pub use one_byte_struct_type::OneByteStruct; pub use one_enum_with_payload_table::*; -pub use one_enum_with_payload_type::*; +pub use one_enum_with_payload_type::OneEnumWithPayload; pub use one_every_primitive_struct_table::*; -pub use one_every_primitive_struct_type::*; +pub use one_every_primitive_struct_type::OneEveryPrimitiveStruct; pub use one_every_vec_struct_table::*; -pub use one_every_vec_struct_type::*; +pub use one_every_vec_struct_type::OneEveryVecStruct; pub use one_f_32_table::*; -pub use one_f_32_type::*; +pub use one_f_32_type::OneF32; pub use one_f_64_table::*; -pub use one_f_64_type::*; +pub use one_f_64_type::OneF64; pub use one_i_128_table::*; -pub use one_i_128_type::*; +pub use one_i_128_type::OneI128; pub use one_i_16_table::*; -pub use one_i_16_type::*; +pub use one_i_16_type::OneI16; pub use one_i_256_table::*; -pub use one_i_256_type::*; +pub use one_i_256_type::OneI256; pub use one_i_32_table::*; -pub use one_i_32_type::*; +pub use one_i_32_type::OneI32; pub use one_i_64_table::*; -pub use one_i_64_type::*; +pub use one_i_64_type::OneI64; pub use one_i_8_table::*; -pub use one_i_8_type::*; +pub use one_i_8_type::OneI8; pub use one_identity_table::*; -pub use one_identity_type::*; +pub use one_identity_type::OneIdentity; pub use one_simple_enum_table::*; -pub use one_simple_enum_type::*; +pub use one_simple_enum_type::OneSimpleEnum; pub use one_string_table::*; -pub use one_string_type::*; +pub use one_string_type::OneString; pub use one_u_128_table::*; -pub use one_u_128_type::*; +pub use one_u_128_type::OneU128; pub use one_u_16_table::*; -pub use one_u_16_type::*; +pub use one_u_16_type::OneU16; pub use one_u_256_table::*; -pub use one_u_256_type::*; +pub use one_u_256_type::OneU256; pub use one_u_32_table::*; -pub use one_u_32_type::*; +pub use one_u_32_type::OneU32; pub use one_u_64_table::*; -pub use one_u_64_type::*; +pub use one_u_64_type::OneU64; pub use one_u_8_table::*; -pub use one_u_8_type::*; +pub use one_u_8_type::OneU8; pub use one_unit_struct_table::*; -pub use one_unit_struct_type::*; +pub use one_unit_struct_type::OneUnitStruct; pub use option_every_primitive_struct_table::*; -pub use option_every_primitive_struct_type::*; +pub use option_every_primitive_struct_type::OptionEveryPrimitiveStruct; pub use option_i_32_table::*; -pub use option_i_32_type::*; +pub use option_i_32_type::OptionI32; pub use option_identity_table::*; -pub use option_identity_type::*; +pub use option_identity_type::OptionIdentity; pub use option_simple_enum_table::*; -pub use option_simple_enum_type::*; +pub use option_simple_enum_type::OptionSimpleEnum; pub use option_string_table::*; -pub use option_string_type::*; +pub use option_string_type::OptionString; pub use option_vec_option_i_32_table::*; -pub use option_vec_option_i_32_type::*; +pub use option_vec_option_i_32_type::OptionVecOptionI32; pub use pk_address_table::*; -pub use pk_address_type::*; +pub use pk_address_type::PkAddress; pub use pk_bool_table::*; -pub use pk_bool_type::*; +pub use pk_bool_type::PkBool; pub use pk_i_128_table::*; -pub use pk_i_128_type::*; +pub use pk_i_128_type::PkI128; pub use pk_i_16_table::*; -pub use pk_i_16_type::*; +pub use pk_i_16_type::PkI16; pub use pk_i_256_table::*; -pub use pk_i_256_type::*; +pub use pk_i_256_type::PkI256; pub use pk_i_32_table::*; -pub use pk_i_32_type::*; +pub use pk_i_32_type::PkI32; pub use pk_i_64_table::*; -pub use pk_i_64_type::*; +pub use pk_i_64_type::PkI64; pub use pk_i_8_table::*; -pub use pk_i_8_type::*; +pub use pk_i_8_type::PkI8; pub use pk_identity_table::*; -pub use pk_identity_type::*; +pub use pk_identity_type::PkIdentity; pub use pk_string_table::*; -pub use pk_string_type::*; +pub use pk_string_type::PkString; pub use pk_u_128_table::*; -pub use pk_u_128_type::*; +pub use pk_u_128_type::PkU128; pub use pk_u_16_table::*; -pub use pk_u_16_type::*; +pub use pk_u_16_type::PkU16; pub use pk_u_256_table::*; -pub use pk_u_256_type::*; +pub use pk_u_256_type::PkU256; pub use pk_u_32_table::*; -pub use pk_u_32_type::*; +pub use pk_u_32_type::PkU32; pub use pk_u_64_table::*; -pub use pk_u_64_type::*; +pub use pk_u_64_type::PkU64; pub use pk_u_8_table::*; -pub use pk_u_8_type::*; -pub use simple_enum_type::*; +pub use pk_u_8_type::PkU8; +pub use simple_enum_type::SimpleEnum; pub use table_holds_table_table::*; -pub use table_holds_table_type::*; +pub use table_holds_table_type::TableHoldsTable; pub use unique_address_table::*; -pub use unique_address_type::*; +pub use unique_address_type::UniqueAddress; pub use unique_bool_table::*; -pub use unique_bool_type::*; +pub use unique_bool_type::UniqueBool; pub use unique_i_128_table::*; -pub use unique_i_128_type::*; +pub use unique_i_128_type::UniqueI128; pub use unique_i_16_table::*; -pub use unique_i_16_type::*; +pub use unique_i_16_type::UniqueI16; pub use unique_i_256_table::*; -pub use unique_i_256_type::*; +pub use unique_i_256_type::UniqueI256; pub use unique_i_32_table::*; -pub use unique_i_32_type::*; +pub use unique_i_32_type::UniqueI32; pub use unique_i_64_table::*; -pub use unique_i_64_type::*; +pub use unique_i_64_type::UniqueI64; pub use unique_i_8_table::*; -pub use unique_i_8_type::*; +pub use unique_i_8_type::UniqueI8; pub use unique_identity_table::*; -pub use unique_identity_type::*; +pub use unique_identity_type::UniqueIdentity; pub use unique_string_table::*; -pub use unique_string_type::*; +pub use unique_string_type::UniqueString; pub use unique_u_128_table::*; -pub use unique_u_128_type::*; +pub use unique_u_128_type::UniqueU128; pub use unique_u_16_table::*; -pub use unique_u_16_type::*; +pub use unique_u_16_type::UniqueU16; pub use unique_u_256_table::*; -pub use unique_u_256_type::*; +pub use unique_u_256_type::UniqueU256; pub use unique_u_32_table::*; -pub use unique_u_32_type::*; +pub use unique_u_32_type::UniqueU32; pub use unique_u_64_table::*; -pub use unique_u_64_type::*; +pub use unique_u_64_type::UniqueU64; pub use unique_u_8_table::*; -pub use unique_u_8_type::*; -pub use unit_struct_type::*; -pub use update_pk_address_reducer::*; -pub use update_pk_bool_reducer::*; -pub use update_pk_i_128_reducer::*; -pub use update_pk_i_16_reducer::*; -pub use update_pk_i_256_reducer::*; -pub use update_pk_i_32_reducer::*; -pub use update_pk_i_64_reducer::*; -pub use update_pk_i_8_reducer::*; -pub use update_pk_identity_reducer::*; -pub use update_pk_string_reducer::*; -pub use update_pk_u_128_reducer::*; -pub use update_pk_u_16_reducer::*; -pub use update_pk_u_256_reducer::*; -pub use update_pk_u_32_reducer::*; -pub use update_pk_u_64_reducer::*; -pub use update_pk_u_8_reducer::*; -pub use update_unique_address_reducer::*; -pub use update_unique_bool_reducer::*; -pub use update_unique_i_128_reducer::*; -pub use update_unique_i_16_reducer::*; -pub use update_unique_i_256_reducer::*; -pub use update_unique_i_32_reducer::*; -pub use update_unique_i_64_reducer::*; -pub use update_unique_i_8_reducer::*; -pub use update_unique_identity_reducer::*; -pub use update_unique_string_reducer::*; -pub use update_unique_u_128_reducer::*; -pub use update_unique_u_16_reducer::*; -pub use update_unique_u_256_reducer::*; -pub use update_unique_u_32_reducer::*; -pub use update_unique_u_64_reducer::*; -pub use update_unique_u_8_reducer::*; +pub use unique_u_8_type::UniqueU8; +pub use unit_struct_type::UnitStruct; +pub use update_pk_address_reducer::{set_flags_for_update_pk_address, update_pk_address, UpdatePkAddressCallbackId}; +pub use update_pk_bool_reducer::{set_flags_for_update_pk_bool, update_pk_bool, UpdatePkBoolCallbackId}; +pub use update_pk_i_128_reducer::{set_flags_for_update_pk_i_128, update_pk_i_128, UpdatePkI128CallbackId}; +pub use update_pk_i_16_reducer::{set_flags_for_update_pk_i_16, update_pk_i_16, UpdatePkI16CallbackId}; +pub use update_pk_i_256_reducer::{set_flags_for_update_pk_i_256, update_pk_i_256, UpdatePkI256CallbackId}; +pub use update_pk_i_32_reducer::{set_flags_for_update_pk_i_32, update_pk_i_32, UpdatePkI32CallbackId}; +pub use update_pk_i_64_reducer::{set_flags_for_update_pk_i_64, update_pk_i_64, UpdatePkI64CallbackId}; +pub use update_pk_i_8_reducer::{set_flags_for_update_pk_i_8, update_pk_i_8, UpdatePkI8CallbackId}; +pub use update_pk_identity_reducer::{ + set_flags_for_update_pk_identity, update_pk_identity, UpdatePkIdentityCallbackId, +}; +pub use update_pk_string_reducer::{set_flags_for_update_pk_string, update_pk_string, UpdatePkStringCallbackId}; +pub use update_pk_u_128_reducer::{set_flags_for_update_pk_u_128, update_pk_u_128, UpdatePkU128CallbackId}; +pub use update_pk_u_16_reducer::{set_flags_for_update_pk_u_16, update_pk_u_16, UpdatePkU16CallbackId}; +pub use update_pk_u_256_reducer::{set_flags_for_update_pk_u_256, update_pk_u_256, UpdatePkU256CallbackId}; +pub use update_pk_u_32_reducer::{set_flags_for_update_pk_u_32, update_pk_u_32, UpdatePkU32CallbackId}; +pub use update_pk_u_64_reducer::{set_flags_for_update_pk_u_64, update_pk_u_64, UpdatePkU64CallbackId}; +pub use update_pk_u_8_reducer::{set_flags_for_update_pk_u_8, update_pk_u_8, UpdatePkU8CallbackId}; +pub use update_unique_address_reducer::{ + set_flags_for_update_unique_address, update_unique_address, UpdateUniqueAddressCallbackId, +}; +pub use update_unique_bool_reducer::{ + set_flags_for_update_unique_bool, update_unique_bool, UpdateUniqueBoolCallbackId, +}; +pub use update_unique_i_128_reducer::{ + set_flags_for_update_unique_i_128, update_unique_i_128, UpdateUniqueI128CallbackId, +}; +pub use update_unique_i_16_reducer::{set_flags_for_update_unique_i_16, update_unique_i_16, UpdateUniqueI16CallbackId}; +pub use update_unique_i_256_reducer::{ + set_flags_for_update_unique_i_256, update_unique_i_256, UpdateUniqueI256CallbackId, +}; +pub use update_unique_i_32_reducer::{set_flags_for_update_unique_i_32, update_unique_i_32, UpdateUniqueI32CallbackId}; +pub use update_unique_i_64_reducer::{set_flags_for_update_unique_i_64, update_unique_i_64, UpdateUniqueI64CallbackId}; +pub use update_unique_i_8_reducer::{set_flags_for_update_unique_i_8, update_unique_i_8, UpdateUniqueI8CallbackId}; +pub use update_unique_identity_reducer::{ + set_flags_for_update_unique_identity, update_unique_identity, UpdateUniqueIdentityCallbackId, +}; +pub use update_unique_string_reducer::{ + set_flags_for_update_unique_string, update_unique_string, UpdateUniqueStringCallbackId, +}; +pub use update_unique_u_128_reducer::{ + set_flags_for_update_unique_u_128, update_unique_u_128, UpdateUniqueU128CallbackId, +}; +pub use update_unique_u_16_reducer::{set_flags_for_update_unique_u_16, update_unique_u_16, UpdateUniqueU16CallbackId}; +pub use update_unique_u_256_reducer::{ + set_flags_for_update_unique_u_256, update_unique_u_256, UpdateUniqueU256CallbackId, +}; +pub use update_unique_u_32_reducer::{set_flags_for_update_unique_u_32, update_unique_u_32, UpdateUniqueU32CallbackId}; +pub use update_unique_u_64_reducer::{set_flags_for_update_unique_u_64, update_unique_u_64, UpdateUniqueU64CallbackId}; +pub use update_unique_u_8_reducer::{set_flags_for_update_unique_u_8, update_unique_u_8, UpdateUniqueU8CallbackId}; pub use vec_address_table::*; -pub use vec_address_type::*; +pub use vec_address_type::VecAddress; pub use vec_bool_table::*; -pub use vec_bool_type::*; +pub use vec_bool_type::VecBool; pub use vec_byte_struct_table::*; -pub use vec_byte_struct_type::*; +pub use vec_byte_struct_type::VecByteStruct; pub use vec_enum_with_payload_table::*; -pub use vec_enum_with_payload_type::*; +pub use vec_enum_with_payload_type::VecEnumWithPayload; pub use vec_every_primitive_struct_table::*; -pub use vec_every_primitive_struct_type::*; +pub use vec_every_primitive_struct_type::VecEveryPrimitiveStruct; pub use vec_every_vec_struct_table::*; -pub use vec_every_vec_struct_type::*; +pub use vec_every_vec_struct_type::VecEveryVecStruct; pub use vec_f_32_table::*; -pub use vec_f_32_type::*; +pub use vec_f_32_type::VecF32; pub use vec_f_64_table::*; -pub use vec_f_64_type::*; +pub use vec_f_64_type::VecF64; pub use vec_i_128_table::*; -pub use vec_i_128_type::*; +pub use vec_i_128_type::VecI128; pub use vec_i_16_table::*; -pub use vec_i_16_type::*; +pub use vec_i_16_type::VecI16; pub use vec_i_256_table::*; -pub use vec_i_256_type::*; +pub use vec_i_256_type::VecI256; pub use vec_i_32_table::*; -pub use vec_i_32_type::*; +pub use vec_i_32_type::VecI32; pub use vec_i_64_table::*; -pub use vec_i_64_type::*; +pub use vec_i_64_type::VecI64; pub use vec_i_8_table::*; -pub use vec_i_8_type::*; +pub use vec_i_8_type::VecI8; pub use vec_identity_table::*; -pub use vec_identity_type::*; +pub use vec_identity_type::VecIdentity; pub use vec_simple_enum_table::*; -pub use vec_simple_enum_type::*; +pub use vec_simple_enum_type::VecSimpleEnum; pub use vec_string_table::*; -pub use vec_string_type::*; +pub use vec_string_type::VecString; pub use vec_u_128_table::*; -pub use vec_u_128_type::*; +pub use vec_u_128_type::VecU128; pub use vec_u_16_table::*; -pub use vec_u_16_type::*; +pub use vec_u_16_type::VecU16; pub use vec_u_256_table::*; -pub use vec_u_256_type::*; +pub use vec_u_256_type::VecU256; pub use vec_u_32_table::*; -pub use vec_u_32_type::*; +pub use vec_u_32_type::VecU32; pub use vec_u_64_table::*; -pub use vec_u_64_type::*; +pub use vec_u_64_type::VecU64; pub use vec_u_8_table::*; -pub use vec_u_8_type::*; +pub use vec_u_8_type::VecU8; pub use vec_unit_struct_table::*; -pub use vec_unit_struct_type::*; +pub use vec_unit_struct_type::VecUnitStruct; -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] +#[derive(Clone, PartialEq, Debug)] /// One of the reducers defined by this module. /// @@ -706,168 +826,568 @@ pub use vec_unit_struct_type::*; /// to indicate which reducer caused the event. pub enum Reducer { - DeletePkAddress(delete_pk_address_reducer::DeletePkAddress), - DeletePkBool(delete_pk_bool_reducer::DeletePkBool), - DeletePkI128(delete_pk_i_128_reducer::DeletePkI128), - DeletePkI16(delete_pk_i_16_reducer::DeletePkI16), - DeletePkI256(delete_pk_i_256_reducer::DeletePkI256), - DeletePkI32(delete_pk_i_32_reducer::DeletePkI32), - DeletePkI64(delete_pk_i_64_reducer::DeletePkI64), - DeletePkI8(delete_pk_i_8_reducer::DeletePkI8), - DeletePkIdentity(delete_pk_identity_reducer::DeletePkIdentity), - DeletePkString(delete_pk_string_reducer::DeletePkString), - DeletePkU128(delete_pk_u_128_reducer::DeletePkU128), - DeletePkU16(delete_pk_u_16_reducer::DeletePkU16), - DeletePkU256(delete_pk_u_256_reducer::DeletePkU256), - DeletePkU32(delete_pk_u_32_reducer::DeletePkU32), - DeletePkU64(delete_pk_u_64_reducer::DeletePkU64), - DeletePkU8(delete_pk_u_8_reducer::DeletePkU8), - DeleteUniqueAddress(delete_unique_address_reducer::DeleteUniqueAddress), - DeleteUniqueBool(delete_unique_bool_reducer::DeleteUniqueBool), - DeleteUniqueI128(delete_unique_i_128_reducer::DeleteUniqueI128), - DeleteUniqueI16(delete_unique_i_16_reducer::DeleteUniqueI16), - DeleteUniqueI256(delete_unique_i_256_reducer::DeleteUniqueI256), - DeleteUniqueI32(delete_unique_i_32_reducer::DeleteUniqueI32), - DeleteUniqueI64(delete_unique_i_64_reducer::DeleteUniqueI64), - DeleteUniqueI8(delete_unique_i_8_reducer::DeleteUniqueI8), - DeleteUniqueIdentity(delete_unique_identity_reducer::DeleteUniqueIdentity), - DeleteUniqueString(delete_unique_string_reducer::DeleteUniqueString), - DeleteUniqueU128(delete_unique_u_128_reducer::DeleteUniqueU128), - DeleteUniqueU16(delete_unique_u_16_reducer::DeleteUniqueU16), - DeleteUniqueU256(delete_unique_u_256_reducer::DeleteUniqueU256), - DeleteUniqueU32(delete_unique_u_32_reducer::DeleteUniqueU32), - DeleteUniqueU64(delete_unique_u_64_reducer::DeleteUniqueU64), - DeleteUniqueU8(delete_unique_u_8_reducer::DeleteUniqueU8), - InsertCallerOneAddress(insert_caller_one_address_reducer::InsertCallerOneAddress), - InsertCallerOneIdentity(insert_caller_one_identity_reducer::InsertCallerOneIdentity), - InsertCallerPkAddress(insert_caller_pk_address_reducer::InsertCallerPkAddress), - InsertCallerPkIdentity(insert_caller_pk_identity_reducer::InsertCallerPkIdentity), - InsertCallerUniqueAddress(insert_caller_unique_address_reducer::InsertCallerUniqueAddress), - InsertCallerUniqueIdentity(insert_caller_unique_identity_reducer::InsertCallerUniqueIdentity), - InsertCallerVecAddress(insert_caller_vec_address_reducer::InsertCallerVecAddress), - InsertCallerVecIdentity(insert_caller_vec_identity_reducer::InsertCallerVecIdentity), - InsertLargeTable(insert_large_table_reducer::InsertLargeTable), - InsertOneAddress(insert_one_address_reducer::InsertOneAddress), - InsertOneBool(insert_one_bool_reducer::InsertOneBool), - InsertOneByteStruct(insert_one_byte_struct_reducer::InsertOneByteStruct), - InsertOneEnumWithPayload(insert_one_enum_with_payload_reducer::InsertOneEnumWithPayload), - InsertOneEveryPrimitiveStruct(insert_one_every_primitive_struct_reducer::InsertOneEveryPrimitiveStruct), - InsertOneEveryVecStruct(insert_one_every_vec_struct_reducer::InsertOneEveryVecStruct), - InsertOneF32(insert_one_f_32_reducer::InsertOneF32), - InsertOneF64(insert_one_f_64_reducer::InsertOneF64), - InsertOneI128(insert_one_i_128_reducer::InsertOneI128), - InsertOneI16(insert_one_i_16_reducer::InsertOneI16), - InsertOneI256(insert_one_i_256_reducer::InsertOneI256), - InsertOneI32(insert_one_i_32_reducer::InsertOneI32), - InsertOneI64(insert_one_i_64_reducer::InsertOneI64), - InsertOneI8(insert_one_i_8_reducer::InsertOneI8), - InsertOneIdentity(insert_one_identity_reducer::InsertOneIdentity), - InsertOneSimpleEnum(insert_one_simple_enum_reducer::InsertOneSimpleEnum), - InsertOneString(insert_one_string_reducer::InsertOneString), - InsertOneU128(insert_one_u_128_reducer::InsertOneU128), - InsertOneU16(insert_one_u_16_reducer::InsertOneU16), - InsertOneU256(insert_one_u_256_reducer::InsertOneU256), - InsertOneU32(insert_one_u_32_reducer::InsertOneU32), - InsertOneU64(insert_one_u_64_reducer::InsertOneU64), - InsertOneU8(insert_one_u_8_reducer::InsertOneU8), - InsertOneUnitStruct(insert_one_unit_struct_reducer::InsertOneUnitStruct), - InsertOptionEveryPrimitiveStruct(insert_option_every_primitive_struct_reducer::InsertOptionEveryPrimitiveStruct), - InsertOptionI32(insert_option_i_32_reducer::InsertOptionI32), - InsertOptionIdentity(insert_option_identity_reducer::InsertOptionIdentity), - InsertOptionSimpleEnum(insert_option_simple_enum_reducer::InsertOptionSimpleEnum), - InsertOptionString(insert_option_string_reducer::InsertOptionString), - InsertOptionVecOptionI32(insert_option_vec_option_i_32_reducer::InsertOptionVecOptionI32), - InsertPkAddress(insert_pk_address_reducer::InsertPkAddress), - InsertPkBool(insert_pk_bool_reducer::InsertPkBool), - InsertPkI128(insert_pk_i_128_reducer::InsertPkI128), - InsertPkI16(insert_pk_i_16_reducer::InsertPkI16), - InsertPkI256(insert_pk_i_256_reducer::InsertPkI256), - InsertPkI32(insert_pk_i_32_reducer::InsertPkI32), - InsertPkI64(insert_pk_i_64_reducer::InsertPkI64), - InsertPkI8(insert_pk_i_8_reducer::InsertPkI8), - InsertPkIdentity(insert_pk_identity_reducer::InsertPkIdentity), - InsertPkString(insert_pk_string_reducer::InsertPkString), - InsertPkU128(insert_pk_u_128_reducer::InsertPkU128), - InsertPkU16(insert_pk_u_16_reducer::InsertPkU16), - InsertPkU256(insert_pk_u_256_reducer::InsertPkU256), - InsertPkU32(insert_pk_u_32_reducer::InsertPkU32), - InsertPkU64(insert_pk_u_64_reducer::InsertPkU64), - InsertPkU8(insert_pk_u_8_reducer::InsertPkU8), - InsertPrimitivesAsStrings(insert_primitives_as_strings_reducer::InsertPrimitivesAsStrings), - InsertTableHoldsTable(insert_table_holds_table_reducer::InsertTableHoldsTable), - InsertUniqueAddress(insert_unique_address_reducer::InsertUniqueAddress), - InsertUniqueBool(insert_unique_bool_reducer::InsertUniqueBool), - InsertUniqueI128(insert_unique_i_128_reducer::InsertUniqueI128), - InsertUniqueI16(insert_unique_i_16_reducer::InsertUniqueI16), - InsertUniqueI256(insert_unique_i_256_reducer::InsertUniqueI256), - InsertUniqueI32(insert_unique_i_32_reducer::InsertUniqueI32), - InsertUniqueI64(insert_unique_i_64_reducer::InsertUniqueI64), - InsertUniqueI8(insert_unique_i_8_reducer::InsertUniqueI8), - InsertUniqueIdentity(insert_unique_identity_reducer::InsertUniqueIdentity), - InsertUniqueString(insert_unique_string_reducer::InsertUniqueString), - InsertUniqueU128(insert_unique_u_128_reducer::InsertUniqueU128), - InsertUniqueU16(insert_unique_u_16_reducer::InsertUniqueU16), - InsertUniqueU256(insert_unique_u_256_reducer::InsertUniqueU256), - InsertUniqueU32(insert_unique_u_32_reducer::InsertUniqueU32), - InsertUniqueU64(insert_unique_u_64_reducer::InsertUniqueU64), - InsertUniqueU8(insert_unique_u_8_reducer::InsertUniqueU8), - InsertVecAddress(insert_vec_address_reducer::InsertVecAddress), - InsertVecBool(insert_vec_bool_reducer::InsertVecBool), - InsertVecByteStruct(insert_vec_byte_struct_reducer::InsertVecByteStruct), - InsertVecEnumWithPayload(insert_vec_enum_with_payload_reducer::InsertVecEnumWithPayload), - InsertVecEveryPrimitiveStruct(insert_vec_every_primitive_struct_reducer::InsertVecEveryPrimitiveStruct), - InsertVecEveryVecStruct(insert_vec_every_vec_struct_reducer::InsertVecEveryVecStruct), - InsertVecF32(insert_vec_f_32_reducer::InsertVecF32), - InsertVecF64(insert_vec_f_64_reducer::InsertVecF64), - InsertVecI128(insert_vec_i_128_reducer::InsertVecI128), - InsertVecI16(insert_vec_i_16_reducer::InsertVecI16), - InsertVecI256(insert_vec_i_256_reducer::InsertVecI256), - InsertVecI32(insert_vec_i_32_reducer::InsertVecI32), - InsertVecI64(insert_vec_i_64_reducer::InsertVecI64), - InsertVecI8(insert_vec_i_8_reducer::InsertVecI8), - InsertVecIdentity(insert_vec_identity_reducer::InsertVecIdentity), - InsertVecSimpleEnum(insert_vec_simple_enum_reducer::InsertVecSimpleEnum), - InsertVecString(insert_vec_string_reducer::InsertVecString), - InsertVecU128(insert_vec_u_128_reducer::InsertVecU128), - InsertVecU16(insert_vec_u_16_reducer::InsertVecU16), - InsertVecU256(insert_vec_u_256_reducer::InsertVecU256), - InsertVecU32(insert_vec_u_32_reducer::InsertVecU32), - InsertVecU64(insert_vec_u_64_reducer::InsertVecU64), - InsertVecU8(insert_vec_u_8_reducer::InsertVecU8), - InsertVecUnitStruct(insert_vec_unit_struct_reducer::InsertVecUnitStruct), - NoOpSucceeds(no_op_succeeds_reducer::NoOpSucceeds), - UpdatePkAddress(update_pk_address_reducer::UpdatePkAddress), - UpdatePkBool(update_pk_bool_reducer::UpdatePkBool), - UpdatePkI128(update_pk_i_128_reducer::UpdatePkI128), - UpdatePkI16(update_pk_i_16_reducer::UpdatePkI16), - UpdatePkI256(update_pk_i_256_reducer::UpdatePkI256), - UpdatePkI32(update_pk_i_32_reducer::UpdatePkI32), - UpdatePkI64(update_pk_i_64_reducer::UpdatePkI64), - UpdatePkI8(update_pk_i_8_reducer::UpdatePkI8), - UpdatePkIdentity(update_pk_identity_reducer::UpdatePkIdentity), - UpdatePkString(update_pk_string_reducer::UpdatePkString), - UpdatePkU128(update_pk_u_128_reducer::UpdatePkU128), - UpdatePkU16(update_pk_u_16_reducer::UpdatePkU16), - UpdatePkU256(update_pk_u_256_reducer::UpdatePkU256), - UpdatePkU32(update_pk_u_32_reducer::UpdatePkU32), - UpdatePkU64(update_pk_u_64_reducer::UpdatePkU64), - UpdatePkU8(update_pk_u_8_reducer::UpdatePkU8), - UpdateUniqueAddress(update_unique_address_reducer::UpdateUniqueAddress), - UpdateUniqueBool(update_unique_bool_reducer::UpdateUniqueBool), - UpdateUniqueI128(update_unique_i_128_reducer::UpdateUniqueI128), - UpdateUniqueI16(update_unique_i_16_reducer::UpdateUniqueI16), - UpdateUniqueI256(update_unique_i_256_reducer::UpdateUniqueI256), - UpdateUniqueI32(update_unique_i_32_reducer::UpdateUniqueI32), - UpdateUniqueI64(update_unique_i_64_reducer::UpdateUniqueI64), - UpdateUniqueI8(update_unique_i_8_reducer::UpdateUniqueI8), - UpdateUniqueIdentity(update_unique_identity_reducer::UpdateUniqueIdentity), - UpdateUniqueString(update_unique_string_reducer::UpdateUniqueString), - UpdateUniqueU128(update_unique_u_128_reducer::UpdateUniqueU128), - UpdateUniqueU16(update_unique_u_16_reducer::UpdateUniqueU16), - UpdateUniqueU256(update_unique_u_256_reducer::UpdateUniqueU256), - UpdateUniqueU32(update_unique_u_32_reducer::UpdateUniqueU32), - UpdateUniqueU64(update_unique_u_64_reducer::UpdateUniqueU64), - UpdateUniqueU8(update_unique_u_8_reducer::UpdateUniqueU8), + DeletePkAddress { + a: __sdk::Address, + }, + DeletePkBool { + b: bool, + }, + DeletePkI128 { + n: i128, + }, + DeletePkI16 { + n: i16, + }, + DeletePkI256 { + n: __sats::i256, + }, + DeletePkI32 { + n: i32, + }, + DeletePkI64 { + n: i64, + }, + DeletePkI8 { + n: i8, + }, + DeletePkIdentity { + i: __sdk::Identity, + }, + DeletePkString { + s: String, + }, + DeletePkU128 { + n: u128, + }, + DeletePkU16 { + n: u16, + }, + DeletePkU256 { + n: __sats::u256, + }, + DeletePkU32 { + n: u32, + }, + DeletePkU64 { + n: u64, + }, + DeletePkU8 { + n: u8, + }, + DeleteUniqueAddress { + a: __sdk::Address, + }, + DeleteUniqueBool { + b: bool, + }, + DeleteUniqueI128 { + n: i128, + }, + DeleteUniqueI16 { + n: i16, + }, + DeleteUniqueI256 { + n: __sats::i256, + }, + DeleteUniqueI32 { + n: i32, + }, + DeleteUniqueI64 { + n: i64, + }, + DeleteUniqueI8 { + n: i8, + }, + DeleteUniqueIdentity { + i: __sdk::Identity, + }, + DeleteUniqueString { + s: String, + }, + DeleteUniqueU128 { + n: u128, + }, + DeleteUniqueU16 { + n: u16, + }, + DeleteUniqueU256 { + n: __sats::u256, + }, + DeleteUniqueU32 { + n: u32, + }, + DeleteUniqueU64 { + n: u64, + }, + DeleteUniqueU8 { + n: u8, + }, + InsertCallerOneAddress, + InsertCallerOneIdentity, + InsertCallerPkAddress { + data: i32, + }, + InsertCallerPkIdentity { + data: i32, + }, + InsertCallerUniqueAddress { + data: i32, + }, + InsertCallerUniqueIdentity { + data: i32, + }, + InsertCallerVecAddress, + InsertCallerVecIdentity, + InsertLargeTable { + a: u8, + b: u16, + c: u32, + d: u64, + e: u128, + f: __sats::u256, + g: i8, + h: i16, + i: i32, + j: i64, + k: i128, + l: __sats::i256, + m: bool, + n: f32, + o: f64, + p: String, + q: SimpleEnum, + r: EnumWithPayload, + s: UnitStruct, + t: ByteStruct, + u: EveryPrimitiveStruct, + v: EveryVecStruct, + }, + InsertOneAddress { + a: __sdk::Address, + }, + InsertOneBool { + b: bool, + }, + InsertOneByteStruct { + s: ByteStruct, + }, + InsertOneEnumWithPayload { + e: EnumWithPayload, + }, + InsertOneEveryPrimitiveStruct { + s: EveryPrimitiveStruct, + }, + InsertOneEveryVecStruct { + s: EveryVecStruct, + }, + InsertOneF32 { + f: f32, + }, + InsertOneF64 { + f: f64, + }, + InsertOneI128 { + n: i128, + }, + InsertOneI16 { + n: i16, + }, + InsertOneI256 { + n: __sats::i256, + }, + InsertOneI32 { + n: i32, + }, + InsertOneI64 { + n: i64, + }, + InsertOneI8 { + n: i8, + }, + InsertOneIdentity { + i: __sdk::Identity, + }, + InsertOneSimpleEnum { + e: SimpleEnum, + }, + InsertOneString { + s: String, + }, + InsertOneU128 { + n: u128, + }, + InsertOneU16 { + n: u16, + }, + InsertOneU256 { + n: __sats::u256, + }, + InsertOneU32 { + n: u32, + }, + InsertOneU64 { + n: u64, + }, + InsertOneU8 { + n: u8, + }, + InsertOneUnitStruct { + s: UnitStruct, + }, + InsertOptionEveryPrimitiveStruct { + s: Option, + }, + InsertOptionI32 { + n: Option, + }, + InsertOptionIdentity { + i: Option<__sdk::Identity>, + }, + InsertOptionSimpleEnum { + e: Option, + }, + InsertOptionString { + s: Option, + }, + InsertOptionVecOptionI32 { + v: Option>>, + }, + InsertPkAddress { + a: __sdk::Address, + data: i32, + }, + InsertPkBool { + b: bool, + data: i32, + }, + InsertPkI128 { + n: i128, + data: i32, + }, + InsertPkI16 { + n: i16, + data: i32, + }, + InsertPkI256 { + n: __sats::i256, + data: i32, + }, + InsertPkI32 { + n: i32, + data: i32, + }, + InsertPkI64 { + n: i64, + data: i32, + }, + InsertPkI8 { + n: i8, + data: i32, + }, + InsertPkIdentity { + i: __sdk::Identity, + data: i32, + }, + InsertPkString { + s: String, + data: i32, + }, + InsertPkU128 { + n: u128, + data: i32, + }, + InsertPkU16 { + n: u16, + data: i32, + }, + InsertPkU256 { + n: __sats::u256, + data: i32, + }, + InsertPkU32 { + n: u32, + data: i32, + }, + InsertPkU64 { + n: u64, + data: i32, + }, + InsertPkU8 { + n: u8, + data: i32, + }, + InsertPrimitivesAsStrings { + s: EveryPrimitiveStruct, + }, + InsertTableHoldsTable { + a: OneU8, + b: VecU8, + }, + InsertUniqueAddress { + a: __sdk::Address, + data: i32, + }, + InsertUniqueBool { + b: bool, + data: i32, + }, + InsertUniqueI128 { + n: i128, + data: i32, + }, + InsertUniqueI16 { + n: i16, + data: i32, + }, + InsertUniqueI256 { + n: __sats::i256, + data: i32, + }, + InsertUniqueI32 { + n: i32, + data: i32, + }, + InsertUniqueI64 { + n: i64, + data: i32, + }, + InsertUniqueI8 { + n: i8, + data: i32, + }, + InsertUniqueIdentity { + i: __sdk::Identity, + data: i32, + }, + InsertUniqueString { + s: String, + data: i32, + }, + InsertUniqueU128 { + n: u128, + data: i32, + }, + InsertUniqueU16 { + n: u16, + data: i32, + }, + InsertUniqueU256 { + n: __sats::u256, + data: i32, + }, + InsertUniqueU32 { + n: u32, + data: i32, + }, + InsertUniqueU64 { + n: u64, + data: i32, + }, + InsertUniqueU8 { + n: u8, + data: i32, + }, + InsertVecAddress { + a: Vec<__sdk::Address>, + }, + InsertVecBool { + b: Vec, + }, + InsertVecByteStruct { + s: Vec, + }, + InsertVecEnumWithPayload { + e: Vec, + }, + InsertVecEveryPrimitiveStruct { + s: Vec, + }, + InsertVecEveryVecStruct { + s: Vec, + }, + InsertVecF32 { + f: Vec, + }, + InsertVecF64 { + f: Vec, + }, + InsertVecI128 { + n: Vec, + }, + InsertVecI16 { + n: Vec, + }, + InsertVecI256 { + n: Vec<__sats::i256>, + }, + InsertVecI32 { + n: Vec, + }, + InsertVecI64 { + n: Vec, + }, + InsertVecI8 { + n: Vec, + }, + InsertVecIdentity { + i: Vec<__sdk::Identity>, + }, + InsertVecSimpleEnum { + e: Vec, + }, + InsertVecString { + s: Vec, + }, + InsertVecU128 { + n: Vec, + }, + InsertVecU16 { + n: Vec, + }, + InsertVecU256 { + n: Vec<__sats::u256>, + }, + InsertVecU32 { + n: Vec, + }, + InsertVecU64 { + n: Vec, + }, + InsertVecU8 { + n: Vec, + }, + InsertVecUnitStruct { + s: Vec, + }, + NoOpSucceeds, + UpdatePkAddress { + a: __sdk::Address, + data: i32, + }, + UpdatePkBool { + b: bool, + data: i32, + }, + UpdatePkI128 { + n: i128, + data: i32, + }, + UpdatePkI16 { + n: i16, + data: i32, + }, + UpdatePkI256 { + n: __sats::i256, + data: i32, + }, + UpdatePkI32 { + n: i32, + data: i32, + }, + UpdatePkI64 { + n: i64, + data: i32, + }, + UpdatePkI8 { + n: i8, + data: i32, + }, + UpdatePkIdentity { + i: __sdk::Identity, + data: i32, + }, + UpdatePkString { + s: String, + data: i32, + }, + UpdatePkU128 { + n: u128, + data: i32, + }, + UpdatePkU16 { + n: u16, + data: i32, + }, + UpdatePkU256 { + n: __sats::u256, + data: i32, + }, + UpdatePkU32 { + n: u32, + data: i32, + }, + UpdatePkU64 { + n: u64, + data: i32, + }, + UpdatePkU8 { + n: u8, + data: i32, + }, + UpdateUniqueAddress { + a: __sdk::Address, + data: i32, + }, + UpdateUniqueBool { + b: bool, + data: i32, + }, + UpdateUniqueI128 { + n: i128, + data: i32, + }, + UpdateUniqueI16 { + n: i16, + data: i32, + }, + UpdateUniqueI256 { + n: __sats::i256, + data: i32, + }, + UpdateUniqueI32 { + n: i32, + data: i32, + }, + UpdateUniqueI64 { + n: i64, + data: i32, + }, + UpdateUniqueI8 { + n: i8, + data: i32, + }, + UpdateUniqueIdentity { + i: __sdk::Identity, + data: i32, + }, + UpdateUniqueString { + s: String, + data: i32, + }, + UpdateUniqueU128 { + n: u128, + data: i32, + }, + UpdateUniqueU16 { + n: u16, + data: i32, + }, + UpdateUniqueU256 { + n: __sats::u256, + data: i32, + }, + UpdateUniqueU32 { + n: u32, + data: i32, + }, + UpdateUniqueU64 { + n: u64, + data: i32, + }, + UpdateUniqueU8 { + n: u8, + data: i32, + }, } impl __sdk::InModule for Reducer { @@ -877,334 +1397,168 @@ impl __sdk::InModule for Reducer { impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { - Reducer::DeletePkAddress(_) => "delete_pk_address", - Reducer::DeletePkBool(_) => "delete_pk_bool", - Reducer::DeletePkI128(_) => "delete_pk_i128", - Reducer::DeletePkI16(_) => "delete_pk_i16", - Reducer::DeletePkI256(_) => "delete_pk_i256", - Reducer::DeletePkI32(_) => "delete_pk_i32", - Reducer::DeletePkI64(_) => "delete_pk_i64", - Reducer::DeletePkI8(_) => "delete_pk_i8", - Reducer::DeletePkIdentity(_) => "delete_pk_identity", - Reducer::DeletePkString(_) => "delete_pk_string", - Reducer::DeletePkU128(_) => "delete_pk_u128", - Reducer::DeletePkU16(_) => "delete_pk_u16", - Reducer::DeletePkU256(_) => "delete_pk_u256", - Reducer::DeletePkU32(_) => "delete_pk_u32", - Reducer::DeletePkU64(_) => "delete_pk_u64", - Reducer::DeletePkU8(_) => "delete_pk_u8", - Reducer::DeleteUniqueAddress(_) => "delete_unique_address", - Reducer::DeleteUniqueBool(_) => "delete_unique_bool", - Reducer::DeleteUniqueI128(_) => "delete_unique_i128", - Reducer::DeleteUniqueI16(_) => "delete_unique_i16", - Reducer::DeleteUniqueI256(_) => "delete_unique_i256", - Reducer::DeleteUniqueI32(_) => "delete_unique_i32", - Reducer::DeleteUniqueI64(_) => "delete_unique_i64", - Reducer::DeleteUniqueI8(_) => "delete_unique_i8", - Reducer::DeleteUniqueIdentity(_) => "delete_unique_identity", - Reducer::DeleteUniqueString(_) => "delete_unique_string", - Reducer::DeleteUniqueU128(_) => "delete_unique_u128", - Reducer::DeleteUniqueU16(_) => "delete_unique_u16", - Reducer::DeleteUniqueU256(_) => "delete_unique_u256", - Reducer::DeleteUniqueU32(_) => "delete_unique_u32", - Reducer::DeleteUniqueU64(_) => "delete_unique_u64", - Reducer::DeleteUniqueU8(_) => "delete_unique_u8", - Reducer::InsertCallerOneAddress(_) => "insert_caller_one_address", - Reducer::InsertCallerOneIdentity(_) => "insert_caller_one_identity", - Reducer::InsertCallerPkAddress(_) => "insert_caller_pk_address", - Reducer::InsertCallerPkIdentity(_) => "insert_caller_pk_identity", - Reducer::InsertCallerUniqueAddress(_) => "insert_caller_unique_address", - Reducer::InsertCallerUniqueIdentity(_) => "insert_caller_unique_identity", - Reducer::InsertCallerVecAddress(_) => "insert_caller_vec_address", - Reducer::InsertCallerVecIdentity(_) => "insert_caller_vec_identity", - Reducer::InsertLargeTable(_) => "insert_large_table", - Reducer::InsertOneAddress(_) => "insert_one_address", - Reducer::InsertOneBool(_) => "insert_one_bool", - Reducer::InsertOneByteStruct(_) => "insert_one_byte_struct", - Reducer::InsertOneEnumWithPayload(_) => "insert_one_enum_with_payload", - Reducer::InsertOneEveryPrimitiveStruct(_) => "insert_one_every_primitive_struct", - Reducer::InsertOneEveryVecStruct(_) => "insert_one_every_vec_struct", - Reducer::InsertOneF32(_) => "insert_one_f32", - Reducer::InsertOneF64(_) => "insert_one_f64", - Reducer::InsertOneI128(_) => "insert_one_i128", - Reducer::InsertOneI16(_) => "insert_one_i16", - Reducer::InsertOneI256(_) => "insert_one_i256", - Reducer::InsertOneI32(_) => "insert_one_i32", - Reducer::InsertOneI64(_) => "insert_one_i64", - Reducer::InsertOneI8(_) => "insert_one_i8", - Reducer::InsertOneIdentity(_) => "insert_one_identity", - Reducer::InsertOneSimpleEnum(_) => "insert_one_simple_enum", - Reducer::InsertOneString(_) => "insert_one_string", - Reducer::InsertOneU128(_) => "insert_one_u128", - Reducer::InsertOneU16(_) => "insert_one_u16", - Reducer::InsertOneU256(_) => "insert_one_u256", - Reducer::InsertOneU32(_) => "insert_one_u32", - Reducer::InsertOneU64(_) => "insert_one_u64", - Reducer::InsertOneU8(_) => "insert_one_u8", - Reducer::InsertOneUnitStruct(_) => "insert_one_unit_struct", - Reducer::InsertOptionEveryPrimitiveStruct(_) => "insert_option_every_primitive_struct", - Reducer::InsertOptionI32(_) => "insert_option_i32", - Reducer::InsertOptionIdentity(_) => "insert_option_identity", - Reducer::InsertOptionSimpleEnum(_) => "insert_option_simple_enum", - Reducer::InsertOptionString(_) => "insert_option_string", - Reducer::InsertOptionVecOptionI32(_) => "insert_option_vec_option_i32", - Reducer::InsertPkAddress(_) => "insert_pk_address", - Reducer::InsertPkBool(_) => "insert_pk_bool", - Reducer::InsertPkI128(_) => "insert_pk_i128", - Reducer::InsertPkI16(_) => "insert_pk_i16", - Reducer::InsertPkI256(_) => "insert_pk_i256", - Reducer::InsertPkI32(_) => "insert_pk_i32", - Reducer::InsertPkI64(_) => "insert_pk_i64", - Reducer::InsertPkI8(_) => "insert_pk_i8", - Reducer::InsertPkIdentity(_) => "insert_pk_identity", - Reducer::InsertPkString(_) => "insert_pk_string", - Reducer::InsertPkU128(_) => "insert_pk_u128", - Reducer::InsertPkU16(_) => "insert_pk_u16", - Reducer::InsertPkU256(_) => "insert_pk_u256", - Reducer::InsertPkU32(_) => "insert_pk_u32", - Reducer::InsertPkU64(_) => "insert_pk_u64", - Reducer::InsertPkU8(_) => "insert_pk_u8", - Reducer::InsertPrimitivesAsStrings(_) => "insert_primitives_as_strings", - Reducer::InsertTableHoldsTable(_) => "insert_table_holds_table", - Reducer::InsertUniqueAddress(_) => "insert_unique_address", - Reducer::InsertUniqueBool(_) => "insert_unique_bool", - Reducer::InsertUniqueI128(_) => "insert_unique_i128", - Reducer::InsertUniqueI16(_) => "insert_unique_i16", - Reducer::InsertUniqueI256(_) => "insert_unique_i256", - Reducer::InsertUniqueI32(_) => "insert_unique_i32", - Reducer::InsertUniqueI64(_) => "insert_unique_i64", - Reducer::InsertUniqueI8(_) => "insert_unique_i8", - Reducer::InsertUniqueIdentity(_) => "insert_unique_identity", - Reducer::InsertUniqueString(_) => "insert_unique_string", - Reducer::InsertUniqueU128(_) => "insert_unique_u128", - Reducer::InsertUniqueU16(_) => "insert_unique_u16", - Reducer::InsertUniqueU256(_) => "insert_unique_u256", - Reducer::InsertUniqueU32(_) => "insert_unique_u32", - Reducer::InsertUniqueU64(_) => "insert_unique_u64", - Reducer::InsertUniqueU8(_) => "insert_unique_u8", - Reducer::InsertVecAddress(_) => "insert_vec_address", - Reducer::InsertVecBool(_) => "insert_vec_bool", - Reducer::InsertVecByteStruct(_) => "insert_vec_byte_struct", - Reducer::InsertVecEnumWithPayload(_) => "insert_vec_enum_with_payload", - Reducer::InsertVecEveryPrimitiveStruct(_) => "insert_vec_every_primitive_struct", - Reducer::InsertVecEveryVecStruct(_) => "insert_vec_every_vec_struct", - Reducer::InsertVecF32(_) => "insert_vec_f32", - Reducer::InsertVecF64(_) => "insert_vec_f64", - Reducer::InsertVecI128(_) => "insert_vec_i128", - Reducer::InsertVecI16(_) => "insert_vec_i16", - Reducer::InsertVecI256(_) => "insert_vec_i256", - Reducer::InsertVecI32(_) => "insert_vec_i32", - Reducer::InsertVecI64(_) => "insert_vec_i64", - Reducer::InsertVecI8(_) => "insert_vec_i8", - Reducer::InsertVecIdentity(_) => "insert_vec_identity", - Reducer::InsertVecSimpleEnum(_) => "insert_vec_simple_enum", - Reducer::InsertVecString(_) => "insert_vec_string", - Reducer::InsertVecU128(_) => "insert_vec_u128", - Reducer::InsertVecU16(_) => "insert_vec_u16", - Reducer::InsertVecU256(_) => "insert_vec_u256", - Reducer::InsertVecU32(_) => "insert_vec_u32", - Reducer::InsertVecU64(_) => "insert_vec_u64", - Reducer::InsertVecU8(_) => "insert_vec_u8", - Reducer::InsertVecUnitStruct(_) => "insert_vec_unit_struct", - Reducer::NoOpSucceeds(_) => "no_op_succeeds", - Reducer::UpdatePkAddress(_) => "update_pk_address", - Reducer::UpdatePkBool(_) => "update_pk_bool", - Reducer::UpdatePkI128(_) => "update_pk_i128", - Reducer::UpdatePkI16(_) => "update_pk_i16", - Reducer::UpdatePkI256(_) => "update_pk_i256", - Reducer::UpdatePkI32(_) => "update_pk_i32", - Reducer::UpdatePkI64(_) => "update_pk_i64", - Reducer::UpdatePkI8(_) => "update_pk_i8", - Reducer::UpdatePkIdentity(_) => "update_pk_identity", - Reducer::UpdatePkString(_) => "update_pk_string", - Reducer::UpdatePkU128(_) => "update_pk_u128", - Reducer::UpdatePkU16(_) => "update_pk_u16", - Reducer::UpdatePkU256(_) => "update_pk_u256", - Reducer::UpdatePkU32(_) => "update_pk_u32", - Reducer::UpdatePkU64(_) => "update_pk_u64", - Reducer::UpdatePkU8(_) => "update_pk_u8", - Reducer::UpdateUniqueAddress(_) => "update_unique_address", - Reducer::UpdateUniqueBool(_) => "update_unique_bool", - Reducer::UpdateUniqueI128(_) => "update_unique_i128", - Reducer::UpdateUniqueI16(_) => "update_unique_i16", - Reducer::UpdateUniqueI256(_) => "update_unique_i256", - Reducer::UpdateUniqueI32(_) => "update_unique_i32", - Reducer::UpdateUniqueI64(_) => "update_unique_i64", - Reducer::UpdateUniqueI8(_) => "update_unique_i8", - Reducer::UpdateUniqueIdentity(_) => "update_unique_identity", - Reducer::UpdateUniqueString(_) => "update_unique_string", - Reducer::UpdateUniqueU128(_) => "update_unique_u128", - Reducer::UpdateUniqueU16(_) => "update_unique_u16", - Reducer::UpdateUniqueU256(_) => "update_unique_u256", - Reducer::UpdateUniqueU32(_) => "update_unique_u32", - Reducer::UpdateUniqueU64(_) => "update_unique_u64", - Reducer::UpdateUniqueU8(_) => "update_unique_u8", - } - } - fn reducer_args(&self) -> &dyn std::any::Any { - match self { - Reducer::DeletePkAddress(args) => args, - Reducer::DeletePkBool(args) => args, - Reducer::DeletePkI128(args) => args, - Reducer::DeletePkI16(args) => args, - Reducer::DeletePkI256(args) => args, - Reducer::DeletePkI32(args) => args, - Reducer::DeletePkI64(args) => args, - Reducer::DeletePkI8(args) => args, - Reducer::DeletePkIdentity(args) => args, - Reducer::DeletePkString(args) => args, - Reducer::DeletePkU128(args) => args, - Reducer::DeletePkU16(args) => args, - Reducer::DeletePkU256(args) => args, - Reducer::DeletePkU32(args) => args, - Reducer::DeletePkU64(args) => args, - Reducer::DeletePkU8(args) => args, - Reducer::DeleteUniqueAddress(args) => args, - Reducer::DeleteUniqueBool(args) => args, - Reducer::DeleteUniqueI128(args) => args, - Reducer::DeleteUniqueI16(args) => args, - Reducer::DeleteUniqueI256(args) => args, - Reducer::DeleteUniqueI32(args) => args, - Reducer::DeleteUniqueI64(args) => args, - Reducer::DeleteUniqueI8(args) => args, - Reducer::DeleteUniqueIdentity(args) => args, - Reducer::DeleteUniqueString(args) => args, - Reducer::DeleteUniqueU128(args) => args, - Reducer::DeleteUniqueU16(args) => args, - Reducer::DeleteUniqueU256(args) => args, - Reducer::DeleteUniqueU32(args) => args, - Reducer::DeleteUniqueU64(args) => args, - Reducer::DeleteUniqueU8(args) => args, - Reducer::InsertCallerOneAddress(args) => args, - Reducer::InsertCallerOneIdentity(args) => args, - Reducer::InsertCallerPkAddress(args) => args, - Reducer::InsertCallerPkIdentity(args) => args, - Reducer::InsertCallerUniqueAddress(args) => args, - Reducer::InsertCallerUniqueIdentity(args) => args, - Reducer::InsertCallerVecAddress(args) => args, - Reducer::InsertCallerVecIdentity(args) => args, - Reducer::InsertLargeTable(args) => args, - Reducer::InsertOneAddress(args) => args, - Reducer::InsertOneBool(args) => args, - Reducer::InsertOneByteStruct(args) => args, - Reducer::InsertOneEnumWithPayload(args) => args, - Reducer::InsertOneEveryPrimitiveStruct(args) => args, - Reducer::InsertOneEveryVecStruct(args) => args, - Reducer::InsertOneF32(args) => args, - Reducer::InsertOneF64(args) => args, - Reducer::InsertOneI128(args) => args, - Reducer::InsertOneI16(args) => args, - Reducer::InsertOneI256(args) => args, - Reducer::InsertOneI32(args) => args, - Reducer::InsertOneI64(args) => args, - Reducer::InsertOneI8(args) => args, - Reducer::InsertOneIdentity(args) => args, - Reducer::InsertOneSimpleEnum(args) => args, - Reducer::InsertOneString(args) => args, - Reducer::InsertOneU128(args) => args, - Reducer::InsertOneU16(args) => args, - Reducer::InsertOneU256(args) => args, - Reducer::InsertOneU32(args) => args, - Reducer::InsertOneU64(args) => args, - Reducer::InsertOneU8(args) => args, - Reducer::InsertOneUnitStruct(args) => args, - Reducer::InsertOptionEveryPrimitiveStruct(args) => args, - Reducer::InsertOptionI32(args) => args, - Reducer::InsertOptionIdentity(args) => args, - Reducer::InsertOptionSimpleEnum(args) => args, - Reducer::InsertOptionString(args) => args, - Reducer::InsertOptionVecOptionI32(args) => args, - Reducer::InsertPkAddress(args) => args, - Reducer::InsertPkBool(args) => args, - Reducer::InsertPkI128(args) => args, - Reducer::InsertPkI16(args) => args, - Reducer::InsertPkI256(args) => args, - Reducer::InsertPkI32(args) => args, - Reducer::InsertPkI64(args) => args, - Reducer::InsertPkI8(args) => args, - Reducer::InsertPkIdentity(args) => args, - Reducer::InsertPkString(args) => args, - Reducer::InsertPkU128(args) => args, - Reducer::InsertPkU16(args) => args, - Reducer::InsertPkU256(args) => args, - Reducer::InsertPkU32(args) => args, - Reducer::InsertPkU64(args) => args, - Reducer::InsertPkU8(args) => args, - Reducer::InsertPrimitivesAsStrings(args) => args, - Reducer::InsertTableHoldsTable(args) => args, - Reducer::InsertUniqueAddress(args) => args, - Reducer::InsertUniqueBool(args) => args, - Reducer::InsertUniqueI128(args) => args, - Reducer::InsertUniqueI16(args) => args, - Reducer::InsertUniqueI256(args) => args, - Reducer::InsertUniqueI32(args) => args, - Reducer::InsertUniqueI64(args) => args, - Reducer::InsertUniqueI8(args) => args, - Reducer::InsertUniqueIdentity(args) => args, - Reducer::InsertUniqueString(args) => args, - Reducer::InsertUniqueU128(args) => args, - Reducer::InsertUniqueU16(args) => args, - Reducer::InsertUniqueU256(args) => args, - Reducer::InsertUniqueU32(args) => args, - Reducer::InsertUniqueU64(args) => args, - Reducer::InsertUniqueU8(args) => args, - Reducer::InsertVecAddress(args) => args, - Reducer::InsertVecBool(args) => args, - Reducer::InsertVecByteStruct(args) => args, - Reducer::InsertVecEnumWithPayload(args) => args, - Reducer::InsertVecEveryPrimitiveStruct(args) => args, - Reducer::InsertVecEveryVecStruct(args) => args, - Reducer::InsertVecF32(args) => args, - Reducer::InsertVecF64(args) => args, - Reducer::InsertVecI128(args) => args, - Reducer::InsertVecI16(args) => args, - Reducer::InsertVecI256(args) => args, - Reducer::InsertVecI32(args) => args, - Reducer::InsertVecI64(args) => args, - Reducer::InsertVecI8(args) => args, - Reducer::InsertVecIdentity(args) => args, - Reducer::InsertVecSimpleEnum(args) => args, - Reducer::InsertVecString(args) => args, - Reducer::InsertVecU128(args) => args, - Reducer::InsertVecU16(args) => args, - Reducer::InsertVecU256(args) => args, - Reducer::InsertVecU32(args) => args, - Reducer::InsertVecU64(args) => args, - Reducer::InsertVecU8(args) => args, - Reducer::InsertVecUnitStruct(args) => args, - Reducer::NoOpSucceeds(args) => args, - Reducer::UpdatePkAddress(args) => args, - Reducer::UpdatePkBool(args) => args, - Reducer::UpdatePkI128(args) => args, - Reducer::UpdatePkI16(args) => args, - Reducer::UpdatePkI256(args) => args, - Reducer::UpdatePkI32(args) => args, - Reducer::UpdatePkI64(args) => args, - Reducer::UpdatePkI8(args) => args, - Reducer::UpdatePkIdentity(args) => args, - Reducer::UpdatePkString(args) => args, - Reducer::UpdatePkU128(args) => args, - Reducer::UpdatePkU16(args) => args, - Reducer::UpdatePkU256(args) => args, - Reducer::UpdatePkU32(args) => args, - Reducer::UpdatePkU64(args) => args, - Reducer::UpdatePkU8(args) => args, - Reducer::UpdateUniqueAddress(args) => args, - Reducer::UpdateUniqueBool(args) => args, - Reducer::UpdateUniqueI128(args) => args, - Reducer::UpdateUniqueI16(args) => args, - Reducer::UpdateUniqueI256(args) => args, - Reducer::UpdateUniqueI32(args) => args, - Reducer::UpdateUniqueI64(args) => args, - Reducer::UpdateUniqueI8(args) => args, - Reducer::UpdateUniqueIdentity(args) => args, - Reducer::UpdateUniqueString(args) => args, - Reducer::UpdateUniqueU128(args) => args, - Reducer::UpdateUniqueU16(args) => args, - Reducer::UpdateUniqueU256(args) => args, - Reducer::UpdateUniqueU32(args) => args, - Reducer::UpdateUniqueU64(args) => args, - Reducer::UpdateUniqueU8(args) => args, + Reducer::DeletePkAddress { .. } => "delete_pk_address", + Reducer::DeletePkBool { .. } => "delete_pk_bool", + Reducer::DeletePkI128 { .. } => "delete_pk_i128", + Reducer::DeletePkI16 { .. } => "delete_pk_i16", + Reducer::DeletePkI256 { .. } => "delete_pk_i256", + Reducer::DeletePkI32 { .. } => "delete_pk_i32", + Reducer::DeletePkI64 { .. } => "delete_pk_i64", + Reducer::DeletePkI8 { .. } => "delete_pk_i8", + Reducer::DeletePkIdentity { .. } => "delete_pk_identity", + Reducer::DeletePkString { .. } => "delete_pk_string", + Reducer::DeletePkU128 { .. } => "delete_pk_u128", + Reducer::DeletePkU16 { .. } => "delete_pk_u16", + Reducer::DeletePkU256 { .. } => "delete_pk_u256", + Reducer::DeletePkU32 { .. } => "delete_pk_u32", + Reducer::DeletePkU64 { .. } => "delete_pk_u64", + Reducer::DeletePkU8 { .. } => "delete_pk_u8", + Reducer::DeleteUniqueAddress { .. } => "delete_unique_address", + Reducer::DeleteUniqueBool { .. } => "delete_unique_bool", + Reducer::DeleteUniqueI128 { .. } => "delete_unique_i128", + Reducer::DeleteUniqueI16 { .. } => "delete_unique_i16", + Reducer::DeleteUniqueI256 { .. } => "delete_unique_i256", + Reducer::DeleteUniqueI32 { .. } => "delete_unique_i32", + Reducer::DeleteUniqueI64 { .. } => "delete_unique_i64", + Reducer::DeleteUniqueI8 { .. } => "delete_unique_i8", + Reducer::DeleteUniqueIdentity { .. } => "delete_unique_identity", + Reducer::DeleteUniqueString { .. } => "delete_unique_string", + Reducer::DeleteUniqueU128 { .. } => "delete_unique_u128", + Reducer::DeleteUniqueU16 { .. } => "delete_unique_u16", + Reducer::DeleteUniqueU256 { .. } => "delete_unique_u256", + Reducer::DeleteUniqueU32 { .. } => "delete_unique_u32", + Reducer::DeleteUniqueU64 { .. } => "delete_unique_u64", + Reducer::DeleteUniqueU8 { .. } => "delete_unique_u8", + Reducer::InsertCallerOneAddress => "insert_caller_one_address", + Reducer::InsertCallerOneIdentity => "insert_caller_one_identity", + Reducer::InsertCallerPkAddress { .. } => "insert_caller_pk_address", + Reducer::InsertCallerPkIdentity { .. } => "insert_caller_pk_identity", + Reducer::InsertCallerUniqueAddress { .. } => "insert_caller_unique_address", + Reducer::InsertCallerUniqueIdentity { .. } => "insert_caller_unique_identity", + Reducer::InsertCallerVecAddress => "insert_caller_vec_address", + Reducer::InsertCallerVecIdentity => "insert_caller_vec_identity", + Reducer::InsertLargeTable { .. } => "insert_large_table", + Reducer::InsertOneAddress { .. } => "insert_one_address", + Reducer::InsertOneBool { .. } => "insert_one_bool", + Reducer::InsertOneByteStruct { .. } => "insert_one_byte_struct", + Reducer::InsertOneEnumWithPayload { .. } => "insert_one_enum_with_payload", + Reducer::InsertOneEveryPrimitiveStruct { .. } => "insert_one_every_primitive_struct", + Reducer::InsertOneEveryVecStruct { .. } => "insert_one_every_vec_struct", + Reducer::InsertOneF32 { .. } => "insert_one_f32", + Reducer::InsertOneF64 { .. } => "insert_one_f64", + Reducer::InsertOneI128 { .. } => "insert_one_i128", + Reducer::InsertOneI16 { .. } => "insert_one_i16", + Reducer::InsertOneI256 { .. } => "insert_one_i256", + Reducer::InsertOneI32 { .. } => "insert_one_i32", + Reducer::InsertOneI64 { .. } => "insert_one_i64", + Reducer::InsertOneI8 { .. } => "insert_one_i8", + Reducer::InsertOneIdentity { .. } => "insert_one_identity", + Reducer::InsertOneSimpleEnum { .. } => "insert_one_simple_enum", + Reducer::InsertOneString { .. } => "insert_one_string", + Reducer::InsertOneU128 { .. } => "insert_one_u128", + Reducer::InsertOneU16 { .. } => "insert_one_u16", + Reducer::InsertOneU256 { .. } => "insert_one_u256", + Reducer::InsertOneU32 { .. } => "insert_one_u32", + Reducer::InsertOneU64 { .. } => "insert_one_u64", + Reducer::InsertOneU8 { .. } => "insert_one_u8", + Reducer::InsertOneUnitStruct { .. } => "insert_one_unit_struct", + Reducer::InsertOptionEveryPrimitiveStruct { .. } => "insert_option_every_primitive_struct", + Reducer::InsertOptionI32 { .. } => "insert_option_i32", + Reducer::InsertOptionIdentity { .. } => "insert_option_identity", + Reducer::InsertOptionSimpleEnum { .. } => "insert_option_simple_enum", + Reducer::InsertOptionString { .. } => "insert_option_string", + Reducer::InsertOptionVecOptionI32 { .. } => "insert_option_vec_option_i32", + Reducer::InsertPkAddress { .. } => "insert_pk_address", + Reducer::InsertPkBool { .. } => "insert_pk_bool", + Reducer::InsertPkI128 { .. } => "insert_pk_i128", + Reducer::InsertPkI16 { .. } => "insert_pk_i16", + Reducer::InsertPkI256 { .. } => "insert_pk_i256", + Reducer::InsertPkI32 { .. } => "insert_pk_i32", + Reducer::InsertPkI64 { .. } => "insert_pk_i64", + Reducer::InsertPkI8 { .. } => "insert_pk_i8", + Reducer::InsertPkIdentity { .. } => "insert_pk_identity", + Reducer::InsertPkString { .. } => "insert_pk_string", + Reducer::InsertPkU128 { .. } => "insert_pk_u128", + Reducer::InsertPkU16 { .. } => "insert_pk_u16", + Reducer::InsertPkU256 { .. } => "insert_pk_u256", + Reducer::InsertPkU32 { .. } => "insert_pk_u32", + Reducer::InsertPkU64 { .. } => "insert_pk_u64", + Reducer::InsertPkU8 { .. } => "insert_pk_u8", + Reducer::InsertPrimitivesAsStrings { .. } => "insert_primitives_as_strings", + Reducer::InsertTableHoldsTable { .. } => "insert_table_holds_table", + Reducer::InsertUniqueAddress { .. } => "insert_unique_address", + Reducer::InsertUniqueBool { .. } => "insert_unique_bool", + Reducer::InsertUniqueI128 { .. } => "insert_unique_i128", + Reducer::InsertUniqueI16 { .. } => "insert_unique_i16", + Reducer::InsertUniqueI256 { .. } => "insert_unique_i256", + Reducer::InsertUniqueI32 { .. } => "insert_unique_i32", + Reducer::InsertUniqueI64 { .. } => "insert_unique_i64", + Reducer::InsertUniqueI8 { .. } => "insert_unique_i8", + Reducer::InsertUniqueIdentity { .. } => "insert_unique_identity", + Reducer::InsertUniqueString { .. } => "insert_unique_string", + Reducer::InsertUniqueU128 { .. } => "insert_unique_u128", + Reducer::InsertUniqueU16 { .. } => "insert_unique_u16", + Reducer::InsertUniqueU256 { .. } => "insert_unique_u256", + Reducer::InsertUniqueU32 { .. } => "insert_unique_u32", + Reducer::InsertUniqueU64 { .. } => "insert_unique_u64", + Reducer::InsertUniqueU8 { .. } => "insert_unique_u8", + Reducer::InsertVecAddress { .. } => "insert_vec_address", + Reducer::InsertVecBool { .. } => "insert_vec_bool", + Reducer::InsertVecByteStruct { .. } => "insert_vec_byte_struct", + Reducer::InsertVecEnumWithPayload { .. } => "insert_vec_enum_with_payload", + Reducer::InsertVecEveryPrimitiveStruct { .. } => "insert_vec_every_primitive_struct", + Reducer::InsertVecEveryVecStruct { .. } => "insert_vec_every_vec_struct", + Reducer::InsertVecF32 { .. } => "insert_vec_f32", + Reducer::InsertVecF64 { .. } => "insert_vec_f64", + Reducer::InsertVecI128 { .. } => "insert_vec_i128", + Reducer::InsertVecI16 { .. } => "insert_vec_i16", + Reducer::InsertVecI256 { .. } => "insert_vec_i256", + Reducer::InsertVecI32 { .. } => "insert_vec_i32", + Reducer::InsertVecI64 { .. } => "insert_vec_i64", + Reducer::InsertVecI8 { .. } => "insert_vec_i8", + Reducer::InsertVecIdentity { .. } => "insert_vec_identity", + Reducer::InsertVecSimpleEnum { .. } => "insert_vec_simple_enum", + Reducer::InsertVecString { .. } => "insert_vec_string", + Reducer::InsertVecU128 { .. } => "insert_vec_u128", + Reducer::InsertVecU16 { .. } => "insert_vec_u16", + Reducer::InsertVecU256 { .. } => "insert_vec_u256", + Reducer::InsertVecU32 { .. } => "insert_vec_u32", + Reducer::InsertVecU64 { .. } => "insert_vec_u64", + Reducer::InsertVecU8 { .. } => "insert_vec_u8", + Reducer::InsertVecUnitStruct { .. } => "insert_vec_unit_struct", + Reducer::NoOpSucceeds => "no_op_succeeds", + Reducer::UpdatePkAddress { .. } => "update_pk_address", + Reducer::UpdatePkBool { .. } => "update_pk_bool", + Reducer::UpdatePkI128 { .. } => "update_pk_i128", + Reducer::UpdatePkI16 { .. } => "update_pk_i16", + Reducer::UpdatePkI256 { .. } => "update_pk_i256", + Reducer::UpdatePkI32 { .. } => "update_pk_i32", + Reducer::UpdatePkI64 { .. } => "update_pk_i64", + Reducer::UpdatePkI8 { .. } => "update_pk_i8", + Reducer::UpdatePkIdentity { .. } => "update_pk_identity", + Reducer::UpdatePkString { .. } => "update_pk_string", + Reducer::UpdatePkU128 { .. } => "update_pk_u128", + Reducer::UpdatePkU16 { .. } => "update_pk_u16", + Reducer::UpdatePkU256 { .. } => "update_pk_u256", + Reducer::UpdatePkU32 { .. } => "update_pk_u32", + Reducer::UpdatePkU64 { .. } => "update_pk_u64", + Reducer::UpdatePkU8 { .. } => "update_pk_u8", + Reducer::UpdateUniqueAddress { .. } => "update_unique_address", + Reducer::UpdateUniqueBool { .. } => "update_unique_bool", + Reducer::UpdateUniqueI128 { .. } => "update_unique_i128", + Reducer::UpdateUniqueI16 { .. } => "update_unique_i16", + Reducer::UpdateUniqueI256 { .. } => "update_unique_i256", + Reducer::UpdateUniqueI32 { .. } => "update_unique_i32", + Reducer::UpdateUniqueI64 { .. } => "update_unique_i64", + Reducer::UpdateUniqueI8 { .. } => "update_unique_i8", + Reducer::UpdateUniqueIdentity { .. } => "update_unique_identity", + Reducer::UpdateUniqueString { .. } => "update_unique_string", + Reducer::UpdateUniqueU128 { .. } => "update_unique_u128", + Reducer::UpdateUniqueU16 { .. } => "update_unique_u16", + Reducer::UpdateUniqueU256 { .. } => "update_unique_u256", + Reducer::UpdateUniqueU32 { .. } => "update_unique_u32", + Reducer::UpdateUniqueU64 { .. } => "update_unique_u64", + Reducer::UpdateUniqueU8 { .. } => "update_unique_u8", } } } @@ -1212,651 +1566,910 @@ impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { type Error = __anyhow::Error; fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { match &value.reducer_name[..] { - "delete_pk_address" => Ok(Reducer::DeletePkAddress(__sdk::parse_reducer_args( - "delete_pk_address", - &value.args, - )?)), - "delete_pk_bool" => Ok(Reducer::DeletePkBool(__sdk::parse_reducer_args( + "delete_pk_address" => Ok( + __sdk::parse_reducer_args::( + "delete_pk_address", + &value.args, + )? + .into(), + ), + "delete_pk_bool" => Ok(__sdk::parse_reducer_args::( "delete_pk_bool", &value.args, - )?)), - "delete_pk_i128" => Ok(Reducer::DeletePkI128(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i128" => Ok(__sdk::parse_reducer_args::( "delete_pk_i128", &value.args, - )?)), - "delete_pk_i16" => Ok(Reducer::DeletePkI16(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i16" => Ok(__sdk::parse_reducer_args::( "delete_pk_i16", &value.args, - )?)), - "delete_pk_i256" => Ok(Reducer::DeletePkI256(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i256" => Ok(__sdk::parse_reducer_args::( "delete_pk_i256", &value.args, - )?)), - "delete_pk_i32" => Ok(Reducer::DeletePkI32(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i32" => Ok(__sdk::parse_reducer_args::( "delete_pk_i32", &value.args, - )?)), - "delete_pk_i64" => Ok(Reducer::DeletePkI64(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i64" => Ok(__sdk::parse_reducer_args::( "delete_pk_i64", &value.args, - )?)), - "delete_pk_i8" => Ok(Reducer::DeletePkI8(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_i8" => Ok(__sdk::parse_reducer_args::( "delete_pk_i8", &value.args, - )?)), - "delete_pk_identity" => Ok(Reducer::DeletePkIdentity(__sdk::parse_reducer_args( - "delete_pk_identity", - &value.args, - )?)), - "delete_pk_string" => Ok(Reducer::DeletePkString(__sdk::parse_reducer_args( - "delete_pk_string", - &value.args, - )?)), - "delete_pk_u128" => Ok(Reducer::DeletePkU128(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_identity" => Ok( + __sdk::parse_reducer_args::( + "delete_pk_identity", + &value.args, + )? + .into(), + ), + "delete_pk_string" => Ok( + __sdk::parse_reducer_args::( + "delete_pk_string", + &value.args, + )? + .into(), + ), + "delete_pk_u128" => Ok(__sdk::parse_reducer_args::( "delete_pk_u128", &value.args, - )?)), - "delete_pk_u16" => Ok(Reducer::DeletePkU16(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_u16" => Ok(__sdk::parse_reducer_args::( "delete_pk_u16", &value.args, - )?)), - "delete_pk_u256" => Ok(Reducer::DeletePkU256(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_u256" => Ok(__sdk::parse_reducer_args::( "delete_pk_u256", &value.args, - )?)), - "delete_pk_u32" => Ok(Reducer::DeletePkU32(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_u32" => Ok(__sdk::parse_reducer_args::( "delete_pk_u32", &value.args, - )?)), - "delete_pk_u64" => Ok(Reducer::DeletePkU64(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_u64" => Ok(__sdk::parse_reducer_args::( "delete_pk_u64", &value.args, - )?)), - "delete_pk_u8" => Ok(Reducer::DeletePkU8(__sdk::parse_reducer_args( + )? + .into()), + "delete_pk_u8" => Ok(__sdk::parse_reducer_args::( "delete_pk_u8", &value.args, - )?)), - "delete_unique_address" => Ok(Reducer::DeleteUniqueAddress(__sdk::parse_reducer_args( - "delete_unique_address", - &value.args, - )?)), - "delete_unique_bool" => Ok(Reducer::DeleteUniqueBool(__sdk::parse_reducer_args( - "delete_unique_bool", - &value.args, - )?)), - "delete_unique_i128" => Ok(Reducer::DeleteUniqueI128(__sdk::parse_reducer_args( - "delete_unique_i128", - &value.args, - )?)), - "delete_unique_i16" => Ok(Reducer::DeleteUniqueI16(__sdk::parse_reducer_args( - "delete_unique_i16", - &value.args, - )?)), - "delete_unique_i256" => Ok(Reducer::DeleteUniqueI256(__sdk::parse_reducer_args( - "delete_unique_i256", - &value.args, - )?)), - "delete_unique_i32" => Ok(Reducer::DeleteUniqueI32(__sdk::parse_reducer_args( - "delete_unique_i32", - &value.args, - )?)), - "delete_unique_i64" => Ok(Reducer::DeleteUniqueI64(__sdk::parse_reducer_args( - "delete_unique_i64", - &value.args, - )?)), - "delete_unique_i8" => Ok(Reducer::DeleteUniqueI8(__sdk::parse_reducer_args( - "delete_unique_i8", - &value.args, - )?)), - "delete_unique_identity" => Ok(Reducer::DeleteUniqueIdentity(__sdk::parse_reducer_args( - "delete_unique_identity", - &value.args, - )?)), - "delete_unique_string" => Ok(Reducer::DeleteUniqueString(__sdk::parse_reducer_args( - "delete_unique_string", - &value.args, - )?)), - "delete_unique_u128" => Ok(Reducer::DeleteUniqueU128(__sdk::parse_reducer_args( - "delete_unique_u128", - &value.args, - )?)), - "delete_unique_u16" => Ok(Reducer::DeleteUniqueU16(__sdk::parse_reducer_args( - "delete_unique_u16", - &value.args, - )?)), - "delete_unique_u256" => Ok(Reducer::DeleteUniqueU256(__sdk::parse_reducer_args( - "delete_unique_u256", - &value.args, - )?)), - "delete_unique_u32" => Ok(Reducer::DeleteUniqueU32(__sdk::parse_reducer_args( - "delete_unique_u32", - &value.args, - )?)), - "delete_unique_u64" => Ok(Reducer::DeleteUniqueU64(__sdk::parse_reducer_args( - "delete_unique_u64", - &value.args, - )?)), - "delete_unique_u8" => Ok(Reducer::DeleteUniqueU8(__sdk::parse_reducer_args( - "delete_unique_u8", - &value.args, - )?)), - "insert_caller_one_address" => Ok(Reducer::InsertCallerOneAddress(__sdk::parse_reducer_args( - "insert_caller_one_address", - &value.args, - )?)), - "insert_caller_one_identity" => Ok(Reducer::InsertCallerOneIdentity(__sdk::parse_reducer_args( - "insert_caller_one_identity", - &value.args, - )?)), - "insert_caller_pk_address" => Ok(Reducer::InsertCallerPkAddress(__sdk::parse_reducer_args( - "insert_caller_pk_address", - &value.args, - )?)), - "insert_caller_pk_identity" => Ok(Reducer::InsertCallerPkIdentity(__sdk::parse_reducer_args( - "insert_caller_pk_identity", - &value.args, - )?)), - "insert_caller_unique_address" => Ok(Reducer::InsertCallerUniqueAddress(__sdk::parse_reducer_args( - "insert_caller_unique_address", - &value.args, - )?)), - "insert_caller_unique_identity" => Ok(Reducer::InsertCallerUniqueIdentity(__sdk::parse_reducer_args( - "insert_caller_unique_identity", - &value.args, - )?)), - "insert_caller_vec_address" => Ok(Reducer::InsertCallerVecAddress(__sdk::parse_reducer_args( - "insert_caller_vec_address", - &value.args, - )?)), - "insert_caller_vec_identity" => Ok(Reducer::InsertCallerVecIdentity(__sdk::parse_reducer_args( - "insert_caller_vec_identity", - &value.args, - )?)), - "insert_large_table" => Ok(Reducer::InsertLargeTable(__sdk::parse_reducer_args( - "insert_large_table", - &value.args, - )?)), - "insert_one_address" => Ok(Reducer::InsertOneAddress(__sdk::parse_reducer_args( - "insert_one_address", - &value.args, - )?)), - "insert_one_bool" => Ok(Reducer::InsertOneBool(__sdk::parse_reducer_args( + )? + .into()), + "delete_unique_address" => Ok(__sdk::parse_reducer_args::< + delete_unique_address_reducer::DeleteUniqueAddressArgs, + >("delete_unique_address", &value.args)? + .into()), + "delete_unique_bool" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_bool", + &value.args, + )? + .into(), + ), + "delete_unique_i128" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i128", + &value.args, + )? + .into(), + ), + "delete_unique_i16" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i16", + &value.args, + )? + .into(), + ), + "delete_unique_i256" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i256", + &value.args, + )? + .into(), + ), + "delete_unique_i32" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i32", + &value.args, + )? + .into(), + ), + "delete_unique_i64" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i64", + &value.args, + )? + .into(), + ), + "delete_unique_i8" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_i8", + &value.args, + )? + .into(), + ), + "delete_unique_identity" => Ok(__sdk::parse_reducer_args::< + delete_unique_identity_reducer::DeleteUniqueIdentityArgs, + >("delete_unique_identity", &value.args)? + .into()), + "delete_unique_string" => Ok(__sdk::parse_reducer_args::< + delete_unique_string_reducer::DeleteUniqueStringArgs, + >("delete_unique_string", &value.args)? + .into()), + "delete_unique_u128" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u128", + &value.args, + )? + .into(), + ), + "delete_unique_u16" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u16", + &value.args, + )? + .into(), + ), + "delete_unique_u256" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u256", + &value.args, + )? + .into(), + ), + "delete_unique_u32" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u32", + &value.args, + )? + .into(), + ), + "delete_unique_u64" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u64", + &value.args, + )? + .into(), + ), + "delete_unique_u8" => Ok( + __sdk::parse_reducer_args::( + "delete_unique_u8", + &value.args, + )? + .into(), + ), + "insert_caller_one_address" => Ok(__sdk::parse_reducer_args::< + insert_caller_one_address_reducer::InsertCallerOneAddressArgs, + >("insert_caller_one_address", &value.args)? + .into()), + "insert_caller_one_identity" => Ok(__sdk::parse_reducer_args::< + insert_caller_one_identity_reducer::InsertCallerOneIdentityArgs, + >("insert_caller_one_identity", &value.args)? + .into()), + "insert_caller_pk_address" => Ok(__sdk::parse_reducer_args::< + insert_caller_pk_address_reducer::InsertCallerPkAddressArgs, + >("insert_caller_pk_address", &value.args)? + .into()), + "insert_caller_pk_identity" => Ok(__sdk::parse_reducer_args::< + insert_caller_pk_identity_reducer::InsertCallerPkIdentityArgs, + >("insert_caller_pk_identity", &value.args)? + .into()), + "insert_caller_unique_address" => Ok(__sdk::parse_reducer_args::< + insert_caller_unique_address_reducer::InsertCallerUniqueAddressArgs, + >("insert_caller_unique_address", &value.args)? + .into()), + "insert_caller_unique_identity" => Ok(__sdk::parse_reducer_args::< + insert_caller_unique_identity_reducer::InsertCallerUniqueIdentityArgs, + >("insert_caller_unique_identity", &value.args)? + .into()), + "insert_caller_vec_address" => Ok(__sdk::parse_reducer_args::< + insert_caller_vec_address_reducer::InsertCallerVecAddressArgs, + >("insert_caller_vec_address", &value.args)? + .into()), + "insert_caller_vec_identity" => Ok(__sdk::parse_reducer_args::< + insert_caller_vec_identity_reducer::InsertCallerVecIdentityArgs, + >("insert_caller_vec_identity", &value.args)? + .into()), + "insert_large_table" => Ok( + __sdk::parse_reducer_args::( + "insert_large_table", + &value.args, + )? + .into(), + ), + "insert_one_address" => Ok( + __sdk::parse_reducer_args::( + "insert_one_address", + &value.args, + )? + .into(), + ), + "insert_one_bool" => Ok(__sdk::parse_reducer_args::( "insert_one_bool", &value.args, - )?)), - "insert_one_byte_struct" => Ok(Reducer::InsertOneByteStruct(__sdk::parse_reducer_args( - "insert_one_byte_struct", - &value.args, - )?)), - "insert_one_enum_with_payload" => Ok(Reducer::InsertOneEnumWithPayload(__sdk::parse_reducer_args( - "insert_one_enum_with_payload", - &value.args, - )?)), - "insert_one_every_primitive_struct" => Ok(Reducer::InsertOneEveryPrimitiveStruct( - __sdk::parse_reducer_args("insert_one_every_primitive_struct", &value.args)?, - )), - "insert_one_every_vec_struct" => Ok(Reducer::InsertOneEveryVecStruct(__sdk::parse_reducer_args( - "insert_one_every_vec_struct", - &value.args, - )?)), - "insert_one_f32" => Ok(Reducer::InsertOneF32(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_byte_struct" => Ok(__sdk::parse_reducer_args::< + insert_one_byte_struct_reducer::InsertOneByteStructArgs, + >("insert_one_byte_struct", &value.args)? + .into()), + "insert_one_enum_with_payload" => Ok(__sdk::parse_reducer_args::< + insert_one_enum_with_payload_reducer::InsertOneEnumWithPayloadArgs, + >("insert_one_enum_with_payload", &value.args)? + .into()), + "insert_one_every_primitive_struct" => Ok(__sdk::parse_reducer_args::< + insert_one_every_primitive_struct_reducer::InsertOneEveryPrimitiveStructArgs, + >("insert_one_every_primitive_struct", &value.args)? + .into()), + "insert_one_every_vec_struct" => Ok(__sdk::parse_reducer_args::< + insert_one_every_vec_struct_reducer::InsertOneEveryVecStructArgs, + >("insert_one_every_vec_struct", &value.args)? + .into()), + "insert_one_f32" => Ok(__sdk::parse_reducer_args::( "insert_one_f32", &value.args, - )?)), - "insert_one_f64" => Ok(Reducer::InsertOneF64(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_f64" => Ok(__sdk::parse_reducer_args::( "insert_one_f64", &value.args, - )?)), - "insert_one_i128" => Ok(Reducer::InsertOneI128(__sdk::parse_reducer_args( - "insert_one_i128", - &value.args, - )?)), - "insert_one_i16" => Ok(Reducer::InsertOneI16(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_i128" => Ok( + __sdk::parse_reducer_args::( + "insert_one_i128", + &value.args, + )? + .into(), + ), + "insert_one_i16" => Ok(__sdk::parse_reducer_args::( "insert_one_i16", &value.args, - )?)), - "insert_one_i256" => Ok(Reducer::InsertOneI256(__sdk::parse_reducer_args( - "insert_one_i256", - &value.args, - )?)), - "insert_one_i32" => Ok(Reducer::InsertOneI32(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_i256" => Ok( + __sdk::parse_reducer_args::( + "insert_one_i256", + &value.args, + )? + .into(), + ), + "insert_one_i32" => Ok(__sdk::parse_reducer_args::( "insert_one_i32", &value.args, - )?)), - "insert_one_i64" => Ok(Reducer::InsertOneI64(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_i64" => Ok(__sdk::parse_reducer_args::( "insert_one_i64", &value.args, - )?)), - "insert_one_i8" => Ok(Reducer::InsertOneI8(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_i8" => Ok(__sdk::parse_reducer_args::( "insert_one_i8", &value.args, - )?)), - "insert_one_identity" => Ok(Reducer::InsertOneIdentity(__sdk::parse_reducer_args( - "insert_one_identity", - &value.args, - )?)), - "insert_one_simple_enum" => Ok(Reducer::InsertOneSimpleEnum(__sdk::parse_reducer_args( - "insert_one_simple_enum", - &value.args, - )?)), - "insert_one_string" => Ok(Reducer::InsertOneString(__sdk::parse_reducer_args( - "insert_one_string", - &value.args, - )?)), - "insert_one_u128" => Ok(Reducer::InsertOneU128(__sdk::parse_reducer_args( - "insert_one_u128", - &value.args, - )?)), - "insert_one_u16" => Ok(Reducer::InsertOneU16(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_identity" => Ok( + __sdk::parse_reducer_args::( + "insert_one_identity", + &value.args, + )? + .into(), + ), + "insert_one_simple_enum" => Ok(__sdk::parse_reducer_args::< + insert_one_simple_enum_reducer::InsertOneSimpleEnumArgs, + >("insert_one_simple_enum", &value.args)? + .into()), + "insert_one_string" => Ok( + __sdk::parse_reducer_args::( + "insert_one_string", + &value.args, + )? + .into(), + ), + "insert_one_u128" => Ok( + __sdk::parse_reducer_args::( + "insert_one_u128", + &value.args, + )? + .into(), + ), + "insert_one_u16" => Ok(__sdk::parse_reducer_args::( "insert_one_u16", &value.args, - )?)), - "insert_one_u256" => Ok(Reducer::InsertOneU256(__sdk::parse_reducer_args( - "insert_one_u256", - &value.args, - )?)), - "insert_one_u32" => Ok(Reducer::InsertOneU32(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_u256" => Ok( + __sdk::parse_reducer_args::( + "insert_one_u256", + &value.args, + )? + .into(), + ), + "insert_one_u32" => Ok(__sdk::parse_reducer_args::( "insert_one_u32", &value.args, - )?)), - "insert_one_u64" => Ok(Reducer::InsertOneU64(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_u64" => Ok(__sdk::parse_reducer_args::( "insert_one_u64", &value.args, - )?)), - "insert_one_u8" => Ok(Reducer::InsertOneU8(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_u8" => Ok(__sdk::parse_reducer_args::( "insert_one_u8", &value.args, - )?)), - "insert_one_unit_struct" => Ok(Reducer::InsertOneUnitStruct(__sdk::parse_reducer_args( - "insert_one_unit_struct", - &value.args, - )?)), - "insert_option_every_primitive_struct" => Ok(Reducer::InsertOptionEveryPrimitiveStruct( - __sdk::parse_reducer_args("insert_option_every_primitive_struct", &value.args)?, - )), - "insert_option_i32" => Ok(Reducer::InsertOptionI32(__sdk::parse_reducer_args( - "insert_option_i32", - &value.args, - )?)), - "insert_option_identity" => Ok(Reducer::InsertOptionIdentity(__sdk::parse_reducer_args( - "insert_option_identity", - &value.args, - )?)), - "insert_option_simple_enum" => Ok(Reducer::InsertOptionSimpleEnum(__sdk::parse_reducer_args( - "insert_option_simple_enum", - &value.args, - )?)), - "insert_option_string" => Ok(Reducer::InsertOptionString(__sdk::parse_reducer_args( - "insert_option_string", - &value.args, - )?)), - "insert_option_vec_option_i32" => Ok(Reducer::InsertOptionVecOptionI32(__sdk::parse_reducer_args( - "insert_option_vec_option_i32", - &value.args, - )?)), - "insert_pk_address" => Ok(Reducer::InsertPkAddress(__sdk::parse_reducer_args( - "insert_pk_address", - &value.args, - )?)), - "insert_pk_bool" => Ok(Reducer::InsertPkBool(__sdk::parse_reducer_args( + )? + .into()), + "insert_one_unit_struct" => Ok(__sdk::parse_reducer_args::< + insert_one_unit_struct_reducer::InsertOneUnitStructArgs, + >("insert_one_unit_struct", &value.args)? + .into()), + "insert_option_every_primitive_struct" => { + Ok(__sdk::parse_reducer_args::< + insert_option_every_primitive_struct_reducer::InsertOptionEveryPrimitiveStructArgs, + >("insert_option_every_primitive_struct", &value.args)? + .into()) + } + "insert_option_i32" => Ok( + __sdk::parse_reducer_args::( + "insert_option_i32", + &value.args, + )? + .into(), + ), + "insert_option_identity" => Ok(__sdk::parse_reducer_args::< + insert_option_identity_reducer::InsertOptionIdentityArgs, + >("insert_option_identity", &value.args)? + .into()), + "insert_option_simple_enum" => Ok(__sdk::parse_reducer_args::< + insert_option_simple_enum_reducer::InsertOptionSimpleEnumArgs, + >("insert_option_simple_enum", &value.args)? + .into()), + "insert_option_string" => Ok(__sdk::parse_reducer_args::< + insert_option_string_reducer::InsertOptionStringArgs, + >("insert_option_string", &value.args)? + .into()), + "insert_option_vec_option_i32" => Ok(__sdk::parse_reducer_args::< + insert_option_vec_option_i_32_reducer::InsertOptionVecOptionI32Args, + >("insert_option_vec_option_i32", &value.args)? + .into()), + "insert_pk_address" => Ok( + __sdk::parse_reducer_args::( + "insert_pk_address", + &value.args, + )? + .into(), + ), + "insert_pk_bool" => Ok(__sdk::parse_reducer_args::( "insert_pk_bool", &value.args, - )?)), - "insert_pk_i128" => Ok(Reducer::InsertPkI128(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i128" => Ok(__sdk::parse_reducer_args::( "insert_pk_i128", &value.args, - )?)), - "insert_pk_i16" => Ok(Reducer::InsertPkI16(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i16" => Ok(__sdk::parse_reducer_args::( "insert_pk_i16", &value.args, - )?)), - "insert_pk_i256" => Ok(Reducer::InsertPkI256(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i256" => Ok(__sdk::parse_reducer_args::( "insert_pk_i256", &value.args, - )?)), - "insert_pk_i32" => Ok(Reducer::InsertPkI32(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i32" => Ok(__sdk::parse_reducer_args::( "insert_pk_i32", &value.args, - )?)), - "insert_pk_i64" => Ok(Reducer::InsertPkI64(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i64" => Ok(__sdk::parse_reducer_args::( "insert_pk_i64", &value.args, - )?)), - "insert_pk_i8" => Ok(Reducer::InsertPkI8(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_i8" => Ok(__sdk::parse_reducer_args::( "insert_pk_i8", &value.args, - )?)), - "insert_pk_identity" => Ok(Reducer::InsertPkIdentity(__sdk::parse_reducer_args( - "insert_pk_identity", - &value.args, - )?)), - "insert_pk_string" => Ok(Reducer::InsertPkString(__sdk::parse_reducer_args( - "insert_pk_string", - &value.args, - )?)), - "insert_pk_u128" => Ok(Reducer::InsertPkU128(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_identity" => Ok( + __sdk::parse_reducer_args::( + "insert_pk_identity", + &value.args, + )? + .into(), + ), + "insert_pk_string" => Ok( + __sdk::parse_reducer_args::( + "insert_pk_string", + &value.args, + )? + .into(), + ), + "insert_pk_u128" => Ok(__sdk::parse_reducer_args::( "insert_pk_u128", &value.args, - )?)), - "insert_pk_u16" => Ok(Reducer::InsertPkU16(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_u16" => Ok(__sdk::parse_reducer_args::( "insert_pk_u16", &value.args, - )?)), - "insert_pk_u256" => Ok(Reducer::InsertPkU256(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_u256" => Ok(__sdk::parse_reducer_args::( "insert_pk_u256", &value.args, - )?)), - "insert_pk_u32" => Ok(Reducer::InsertPkU32(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_u32" => Ok(__sdk::parse_reducer_args::( "insert_pk_u32", &value.args, - )?)), - "insert_pk_u64" => Ok(Reducer::InsertPkU64(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_u64" => Ok(__sdk::parse_reducer_args::( "insert_pk_u64", &value.args, - )?)), - "insert_pk_u8" => Ok(Reducer::InsertPkU8(__sdk::parse_reducer_args( + )? + .into()), + "insert_pk_u8" => Ok(__sdk::parse_reducer_args::( "insert_pk_u8", &value.args, - )?)), - "insert_primitives_as_strings" => Ok(Reducer::InsertPrimitivesAsStrings(__sdk::parse_reducer_args( - "insert_primitives_as_strings", - &value.args, - )?)), - "insert_table_holds_table" => Ok(Reducer::InsertTableHoldsTable(__sdk::parse_reducer_args( - "insert_table_holds_table", - &value.args, - )?)), - "insert_unique_address" => Ok(Reducer::InsertUniqueAddress(__sdk::parse_reducer_args( - "insert_unique_address", - &value.args, - )?)), - "insert_unique_bool" => Ok(Reducer::InsertUniqueBool(__sdk::parse_reducer_args( - "insert_unique_bool", - &value.args, - )?)), - "insert_unique_i128" => Ok(Reducer::InsertUniqueI128(__sdk::parse_reducer_args( - "insert_unique_i128", - &value.args, - )?)), - "insert_unique_i16" => Ok(Reducer::InsertUniqueI16(__sdk::parse_reducer_args( - "insert_unique_i16", - &value.args, - )?)), - "insert_unique_i256" => Ok(Reducer::InsertUniqueI256(__sdk::parse_reducer_args( - "insert_unique_i256", - &value.args, - )?)), - "insert_unique_i32" => Ok(Reducer::InsertUniqueI32(__sdk::parse_reducer_args( - "insert_unique_i32", - &value.args, - )?)), - "insert_unique_i64" => Ok(Reducer::InsertUniqueI64(__sdk::parse_reducer_args( - "insert_unique_i64", - &value.args, - )?)), - "insert_unique_i8" => Ok(Reducer::InsertUniqueI8(__sdk::parse_reducer_args( - "insert_unique_i8", - &value.args, - )?)), - "insert_unique_identity" => Ok(Reducer::InsertUniqueIdentity(__sdk::parse_reducer_args( - "insert_unique_identity", - &value.args, - )?)), - "insert_unique_string" => Ok(Reducer::InsertUniqueString(__sdk::parse_reducer_args( - "insert_unique_string", - &value.args, - )?)), - "insert_unique_u128" => Ok(Reducer::InsertUniqueU128(__sdk::parse_reducer_args( - "insert_unique_u128", - &value.args, - )?)), - "insert_unique_u16" => Ok(Reducer::InsertUniqueU16(__sdk::parse_reducer_args( - "insert_unique_u16", - &value.args, - )?)), - "insert_unique_u256" => Ok(Reducer::InsertUniqueU256(__sdk::parse_reducer_args( - "insert_unique_u256", - &value.args, - )?)), - "insert_unique_u32" => Ok(Reducer::InsertUniqueU32(__sdk::parse_reducer_args( - "insert_unique_u32", - &value.args, - )?)), - "insert_unique_u64" => Ok(Reducer::InsertUniqueU64(__sdk::parse_reducer_args( - "insert_unique_u64", - &value.args, - )?)), - "insert_unique_u8" => Ok(Reducer::InsertUniqueU8(__sdk::parse_reducer_args( - "insert_unique_u8", - &value.args, - )?)), - "insert_vec_address" => Ok(Reducer::InsertVecAddress(__sdk::parse_reducer_args( - "insert_vec_address", - &value.args, - )?)), - "insert_vec_bool" => Ok(Reducer::InsertVecBool(__sdk::parse_reducer_args( + )? + .into()), + "insert_primitives_as_strings" => Ok(__sdk::parse_reducer_args::< + insert_primitives_as_strings_reducer::InsertPrimitivesAsStringsArgs, + >("insert_primitives_as_strings", &value.args)? + .into()), + "insert_table_holds_table" => Ok(__sdk::parse_reducer_args::< + insert_table_holds_table_reducer::InsertTableHoldsTableArgs, + >("insert_table_holds_table", &value.args)? + .into()), + "insert_unique_address" => Ok(__sdk::parse_reducer_args::< + insert_unique_address_reducer::InsertUniqueAddressArgs, + >("insert_unique_address", &value.args)? + .into()), + "insert_unique_bool" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_bool", + &value.args, + )? + .into(), + ), + "insert_unique_i128" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i128", + &value.args, + )? + .into(), + ), + "insert_unique_i16" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i16", + &value.args, + )? + .into(), + ), + "insert_unique_i256" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i256", + &value.args, + )? + .into(), + ), + "insert_unique_i32" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i32", + &value.args, + )? + .into(), + ), + "insert_unique_i64" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i64", + &value.args, + )? + .into(), + ), + "insert_unique_i8" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_i8", + &value.args, + )? + .into(), + ), + "insert_unique_identity" => Ok(__sdk::parse_reducer_args::< + insert_unique_identity_reducer::InsertUniqueIdentityArgs, + >("insert_unique_identity", &value.args)? + .into()), + "insert_unique_string" => Ok(__sdk::parse_reducer_args::< + insert_unique_string_reducer::InsertUniqueStringArgs, + >("insert_unique_string", &value.args)? + .into()), + "insert_unique_u128" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u128", + &value.args, + )? + .into(), + ), + "insert_unique_u16" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u16", + &value.args, + )? + .into(), + ), + "insert_unique_u256" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u256", + &value.args, + )? + .into(), + ), + "insert_unique_u32" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u32", + &value.args, + )? + .into(), + ), + "insert_unique_u64" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u64", + &value.args, + )? + .into(), + ), + "insert_unique_u8" => Ok( + __sdk::parse_reducer_args::( + "insert_unique_u8", + &value.args, + )? + .into(), + ), + "insert_vec_address" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_address", + &value.args, + )? + .into(), + ), + "insert_vec_bool" => Ok(__sdk::parse_reducer_args::( "insert_vec_bool", &value.args, - )?)), - "insert_vec_byte_struct" => Ok(Reducer::InsertVecByteStruct(__sdk::parse_reducer_args( - "insert_vec_byte_struct", - &value.args, - )?)), - "insert_vec_enum_with_payload" => Ok(Reducer::InsertVecEnumWithPayload(__sdk::parse_reducer_args( - "insert_vec_enum_with_payload", - &value.args, - )?)), - "insert_vec_every_primitive_struct" => Ok(Reducer::InsertVecEveryPrimitiveStruct( - __sdk::parse_reducer_args("insert_vec_every_primitive_struct", &value.args)?, - )), - "insert_vec_every_vec_struct" => Ok(Reducer::InsertVecEveryVecStruct(__sdk::parse_reducer_args( - "insert_vec_every_vec_struct", - &value.args, - )?)), - "insert_vec_f32" => Ok(Reducer::InsertVecF32(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_byte_struct" => Ok(__sdk::parse_reducer_args::< + insert_vec_byte_struct_reducer::InsertVecByteStructArgs, + >("insert_vec_byte_struct", &value.args)? + .into()), + "insert_vec_enum_with_payload" => Ok(__sdk::parse_reducer_args::< + insert_vec_enum_with_payload_reducer::InsertVecEnumWithPayloadArgs, + >("insert_vec_enum_with_payload", &value.args)? + .into()), + "insert_vec_every_primitive_struct" => Ok(__sdk::parse_reducer_args::< + insert_vec_every_primitive_struct_reducer::InsertVecEveryPrimitiveStructArgs, + >("insert_vec_every_primitive_struct", &value.args)? + .into()), + "insert_vec_every_vec_struct" => Ok(__sdk::parse_reducer_args::< + insert_vec_every_vec_struct_reducer::InsertVecEveryVecStructArgs, + >("insert_vec_every_vec_struct", &value.args)? + .into()), + "insert_vec_f32" => Ok(__sdk::parse_reducer_args::( "insert_vec_f32", &value.args, - )?)), - "insert_vec_f64" => Ok(Reducer::InsertVecF64(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_f64" => Ok(__sdk::parse_reducer_args::( "insert_vec_f64", &value.args, - )?)), - "insert_vec_i128" => Ok(Reducer::InsertVecI128(__sdk::parse_reducer_args( - "insert_vec_i128", - &value.args, - )?)), - "insert_vec_i16" => Ok(Reducer::InsertVecI16(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_i128" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_i128", + &value.args, + )? + .into(), + ), + "insert_vec_i16" => Ok(__sdk::parse_reducer_args::( "insert_vec_i16", &value.args, - )?)), - "insert_vec_i256" => Ok(Reducer::InsertVecI256(__sdk::parse_reducer_args( - "insert_vec_i256", - &value.args, - )?)), - "insert_vec_i32" => Ok(Reducer::InsertVecI32(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_i256" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_i256", + &value.args, + )? + .into(), + ), + "insert_vec_i32" => Ok(__sdk::parse_reducer_args::( "insert_vec_i32", &value.args, - )?)), - "insert_vec_i64" => Ok(Reducer::InsertVecI64(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_i64" => Ok(__sdk::parse_reducer_args::( "insert_vec_i64", &value.args, - )?)), - "insert_vec_i8" => Ok(Reducer::InsertVecI8(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_i8" => Ok(__sdk::parse_reducer_args::( "insert_vec_i8", &value.args, - )?)), - "insert_vec_identity" => Ok(Reducer::InsertVecIdentity(__sdk::parse_reducer_args( - "insert_vec_identity", - &value.args, - )?)), - "insert_vec_simple_enum" => Ok(Reducer::InsertVecSimpleEnum(__sdk::parse_reducer_args( - "insert_vec_simple_enum", - &value.args, - )?)), - "insert_vec_string" => Ok(Reducer::InsertVecString(__sdk::parse_reducer_args( - "insert_vec_string", - &value.args, - )?)), - "insert_vec_u128" => Ok(Reducer::InsertVecU128(__sdk::parse_reducer_args( - "insert_vec_u128", - &value.args, - )?)), - "insert_vec_u16" => Ok(Reducer::InsertVecU16(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_identity" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_identity", + &value.args, + )? + .into(), + ), + "insert_vec_simple_enum" => Ok(__sdk::parse_reducer_args::< + insert_vec_simple_enum_reducer::InsertVecSimpleEnumArgs, + >("insert_vec_simple_enum", &value.args)? + .into()), + "insert_vec_string" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_string", + &value.args, + )? + .into(), + ), + "insert_vec_u128" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_u128", + &value.args, + )? + .into(), + ), + "insert_vec_u16" => Ok(__sdk::parse_reducer_args::( "insert_vec_u16", &value.args, - )?)), - "insert_vec_u256" => Ok(Reducer::InsertVecU256(__sdk::parse_reducer_args( - "insert_vec_u256", - &value.args, - )?)), - "insert_vec_u32" => Ok(Reducer::InsertVecU32(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_u256" => Ok( + __sdk::parse_reducer_args::( + "insert_vec_u256", + &value.args, + )? + .into(), + ), + "insert_vec_u32" => Ok(__sdk::parse_reducer_args::( "insert_vec_u32", &value.args, - )?)), - "insert_vec_u64" => Ok(Reducer::InsertVecU64(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_u64" => Ok(__sdk::parse_reducer_args::( "insert_vec_u64", &value.args, - )?)), - "insert_vec_u8" => Ok(Reducer::InsertVecU8(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_u8" => Ok(__sdk::parse_reducer_args::( "insert_vec_u8", &value.args, - )?)), - "insert_vec_unit_struct" => Ok(Reducer::InsertVecUnitStruct(__sdk::parse_reducer_args( - "insert_vec_unit_struct", - &value.args, - )?)), - "no_op_succeeds" => Ok(Reducer::NoOpSucceeds(__sdk::parse_reducer_args( + )? + .into()), + "insert_vec_unit_struct" => Ok(__sdk::parse_reducer_args::< + insert_vec_unit_struct_reducer::InsertVecUnitStructArgs, + >("insert_vec_unit_struct", &value.args)? + .into()), + "no_op_succeeds" => Ok(__sdk::parse_reducer_args::( "no_op_succeeds", &value.args, - )?)), - "update_pk_address" => Ok(Reducer::UpdatePkAddress(__sdk::parse_reducer_args( - "update_pk_address", - &value.args, - )?)), - "update_pk_bool" => Ok(Reducer::UpdatePkBool(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_address" => Ok( + __sdk::parse_reducer_args::( + "update_pk_address", + &value.args, + )? + .into(), + ), + "update_pk_bool" => Ok(__sdk::parse_reducer_args::( "update_pk_bool", &value.args, - )?)), - "update_pk_i128" => Ok(Reducer::UpdatePkI128(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i128" => Ok(__sdk::parse_reducer_args::( "update_pk_i128", &value.args, - )?)), - "update_pk_i16" => Ok(Reducer::UpdatePkI16(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i16" => Ok(__sdk::parse_reducer_args::( "update_pk_i16", &value.args, - )?)), - "update_pk_i256" => Ok(Reducer::UpdatePkI256(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i256" => Ok(__sdk::parse_reducer_args::( "update_pk_i256", &value.args, - )?)), - "update_pk_i32" => Ok(Reducer::UpdatePkI32(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i32" => Ok(__sdk::parse_reducer_args::( "update_pk_i32", &value.args, - )?)), - "update_pk_i64" => Ok(Reducer::UpdatePkI64(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i64" => Ok(__sdk::parse_reducer_args::( "update_pk_i64", &value.args, - )?)), - "update_pk_i8" => Ok(Reducer::UpdatePkI8(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_i8" => Ok(__sdk::parse_reducer_args::( "update_pk_i8", &value.args, - )?)), - "update_pk_identity" => Ok(Reducer::UpdatePkIdentity(__sdk::parse_reducer_args( - "update_pk_identity", - &value.args, - )?)), - "update_pk_string" => Ok(Reducer::UpdatePkString(__sdk::parse_reducer_args( - "update_pk_string", - &value.args, - )?)), - "update_pk_u128" => Ok(Reducer::UpdatePkU128(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_identity" => Ok( + __sdk::parse_reducer_args::( + "update_pk_identity", + &value.args, + )? + .into(), + ), + "update_pk_string" => Ok( + __sdk::parse_reducer_args::( + "update_pk_string", + &value.args, + )? + .into(), + ), + "update_pk_u128" => Ok(__sdk::parse_reducer_args::( "update_pk_u128", &value.args, - )?)), - "update_pk_u16" => Ok(Reducer::UpdatePkU16(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_u16" => Ok(__sdk::parse_reducer_args::( "update_pk_u16", &value.args, - )?)), - "update_pk_u256" => Ok(Reducer::UpdatePkU256(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_u256" => Ok(__sdk::parse_reducer_args::( "update_pk_u256", &value.args, - )?)), - "update_pk_u32" => Ok(Reducer::UpdatePkU32(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_u32" => Ok(__sdk::parse_reducer_args::( "update_pk_u32", &value.args, - )?)), - "update_pk_u64" => Ok(Reducer::UpdatePkU64(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_u64" => Ok(__sdk::parse_reducer_args::( "update_pk_u64", &value.args, - )?)), - "update_pk_u8" => Ok(Reducer::UpdatePkU8(__sdk::parse_reducer_args( + )? + .into()), + "update_pk_u8" => Ok(__sdk::parse_reducer_args::( "update_pk_u8", &value.args, - )?)), - "update_unique_address" => Ok(Reducer::UpdateUniqueAddress(__sdk::parse_reducer_args( - "update_unique_address", - &value.args, - )?)), - "update_unique_bool" => Ok(Reducer::UpdateUniqueBool(__sdk::parse_reducer_args( - "update_unique_bool", - &value.args, - )?)), - "update_unique_i128" => Ok(Reducer::UpdateUniqueI128(__sdk::parse_reducer_args( - "update_unique_i128", - &value.args, - )?)), - "update_unique_i16" => Ok(Reducer::UpdateUniqueI16(__sdk::parse_reducer_args( - "update_unique_i16", - &value.args, - )?)), - "update_unique_i256" => Ok(Reducer::UpdateUniqueI256(__sdk::parse_reducer_args( - "update_unique_i256", - &value.args, - )?)), - "update_unique_i32" => Ok(Reducer::UpdateUniqueI32(__sdk::parse_reducer_args( - "update_unique_i32", - &value.args, - )?)), - "update_unique_i64" => Ok(Reducer::UpdateUniqueI64(__sdk::parse_reducer_args( - "update_unique_i64", - &value.args, - )?)), - "update_unique_i8" => Ok(Reducer::UpdateUniqueI8(__sdk::parse_reducer_args( - "update_unique_i8", - &value.args, - )?)), - "update_unique_identity" => Ok(Reducer::UpdateUniqueIdentity(__sdk::parse_reducer_args( - "update_unique_identity", - &value.args, - )?)), - "update_unique_string" => Ok(Reducer::UpdateUniqueString(__sdk::parse_reducer_args( - "update_unique_string", - &value.args, - )?)), - "update_unique_u128" => Ok(Reducer::UpdateUniqueU128(__sdk::parse_reducer_args( - "update_unique_u128", - &value.args, - )?)), - "update_unique_u16" => Ok(Reducer::UpdateUniqueU16(__sdk::parse_reducer_args( - "update_unique_u16", - &value.args, - )?)), - "update_unique_u256" => Ok(Reducer::UpdateUniqueU256(__sdk::parse_reducer_args( - "update_unique_u256", - &value.args, - )?)), - "update_unique_u32" => Ok(Reducer::UpdateUniqueU32(__sdk::parse_reducer_args( - "update_unique_u32", - &value.args, - )?)), - "update_unique_u64" => Ok(Reducer::UpdateUniqueU64(__sdk::parse_reducer_args( - "update_unique_u64", - &value.args, - )?)), - "update_unique_u8" => Ok(Reducer::UpdateUniqueU8(__sdk::parse_reducer_args( - "update_unique_u8", - &value.args, - )?)), + )? + .into()), + "update_unique_address" => Ok(__sdk::parse_reducer_args::< + update_unique_address_reducer::UpdateUniqueAddressArgs, + >("update_unique_address", &value.args)? + .into()), + "update_unique_bool" => Ok( + __sdk::parse_reducer_args::( + "update_unique_bool", + &value.args, + )? + .into(), + ), + "update_unique_i128" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i128", + &value.args, + )? + .into(), + ), + "update_unique_i16" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i16", + &value.args, + )? + .into(), + ), + "update_unique_i256" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i256", + &value.args, + )? + .into(), + ), + "update_unique_i32" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i32", + &value.args, + )? + .into(), + ), + "update_unique_i64" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i64", + &value.args, + )? + .into(), + ), + "update_unique_i8" => Ok( + __sdk::parse_reducer_args::( + "update_unique_i8", + &value.args, + )? + .into(), + ), + "update_unique_identity" => Ok(__sdk::parse_reducer_args::< + update_unique_identity_reducer::UpdateUniqueIdentityArgs, + >("update_unique_identity", &value.args)? + .into()), + "update_unique_string" => Ok(__sdk::parse_reducer_args::< + update_unique_string_reducer::UpdateUniqueStringArgs, + >("update_unique_string", &value.args)? + .into()), + "update_unique_u128" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u128", + &value.args, + )? + .into(), + ), + "update_unique_u16" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u16", + &value.args, + )? + .into(), + ), + "update_unique_u256" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u256", + &value.args, + )? + .into(), + ), + "update_unique_u32" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u32", + &value.args, + )? + .into(), + ), + "update_unique_u64" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u64", + &value.args, + )? + .into(), + ), + "update_unique_u8" => Ok( + __sdk::parse_reducer_args::( + "update_unique_u8", + &value.args, + )? + .into(), + ), _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs index 35b35e1d14..cfe9505690 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs @@ -9,9 +9,15 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct NoOpSucceeds {} +pub(super) struct NoOpSucceedsArgs {} -impl __sdk::InModule for NoOpSucceeds { +impl From for super::Reducer { + fn from(args: NoOpSucceedsArgs) -> Self { + Self::NoOpSucceeds + } +} + +impl __sdk::InModule for NoOpSucceedsArgs { type Module = super::RemoteModule; } @@ -46,19 +52,32 @@ pub trait no_op_succeeds { impl no_op_succeeds for super::RemoteReducers { fn no_op_succeeds(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("no_op_succeeds", NoOpSucceeds {}) + self.imp.call_reducer("no_op_succeeds", NoOpSucceedsArgs {}) } fn on_no_op_succeeds( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> NoOpSucceedsCallbackId { - NoOpSucceedsCallbackId(self.imp.on_reducer::( + NoOpSucceedsCallbackId(self.imp.on_reducer( "no_op_succeeds", - Box::new(move |ctx: &super::EventContext, args: &NoOpSucceeds| callback(ctx)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::NoOpSucceeds {}, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx) + }), )) } fn remove_on_no_op_succeeds(&self, callback: NoOpSucceedsCallbackId) { - self.imp.remove_on_reducer::("no_op_succeeds", callback.0) + self.imp.remove_on_reducer("no_op_succeeds", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs index 7451a553a1..e5d800c27f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkAddressTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_address"); - _table.add_unique_constraint::<__sdk::Address>("a", |row| &row.a) + _table.add_unique_constraint::<__sdk::Address>("a", |row| &row.a); } pub struct PkAddressUpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs index a0635b4e00..3afec90520 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkBoolTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_bool"); - _table.add_unique_constraint::("b", |row| &row.b) + _table.add_unique_constraint::("b", |row| &row.b); } pub struct PkBoolUpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs index 28117bb7b5..ddbd96bc39 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI128TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i128"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkI128UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs index 7528ac7555..053ee8ffa2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI16TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i16"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkI16UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs index e029d5ccd9..2db2b0a391 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI256TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i256"); - _table.add_unique_constraint::<__sats::i256>("n", |row| &row.n) + _table.add_unique_constraint::<__sats::i256>("n", |row| &row.n); } pub struct PkI256UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs index 44c7cf1710..1c28287245 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI32TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i32"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkI32UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs index 6f5b573637..46f31da9ae 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI64TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i64"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkI64UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs index 203ca8515c..b8e5e8b1ee 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkI8TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_i8"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkI8UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs index c69958358f..e83e604576 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkIdentityTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_identity"); - _table.add_unique_constraint::<__sdk::Identity>("i", |row| &row.i) + _table.add_unique_constraint::<__sdk::Identity>("i", |row| &row.i); } pub struct PkIdentityUpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs index cc7bf56fa4..987ef9d41a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkStringTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_string"); - _table.add_unique_constraint::("s", |row| &row.s) + _table.add_unique_constraint::("s", |row| &row.s); } pub struct PkStringUpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs index 61fd98d57b..0e322646b5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU128TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u128"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkU128UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs index ed5c29a1c5..c831784bea 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU16TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u16"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkU16UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs index c07e466276..c2cda6d768 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU256TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u256"); - _table.add_unique_constraint::<__sats::u256>("n", |row| &row.n) + _table.add_unique_constraint::<__sats::u256>("n", |row| &row.n); } pub struct PkU256UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs index 816d6a6fe6..5bc5f6961f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU32TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u32"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkU32UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs index 3666051140..b5320f281d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU64TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u64"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkU64UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs index 9b4a64b17f..03fdb5a319 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for PkU8TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("pk_u8"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } pub struct PkU8UpdateCallbackId(__sdk::CallbackId); diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs index eac9a6dfa6..0529e7ca94 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueAddressTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_address"); - _table.add_unique_constraint::<__sdk::Address>("a", |row| &row.a) + _table.add_unique_constraint::<__sdk::Address>("a", |row| &row.a); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs index 7591a6128d..1c6eef00e4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueBoolTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_bool"); - _table.add_unique_constraint::("b", |row| &row.b) + _table.add_unique_constraint::("b", |row| &row.b); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs index a21e6089a2..800f3288f5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI128TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i128"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs index b833204dcd..7df0019bfd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI16TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i16"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs index af3e2903ed..5dbec20049 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI256TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i256"); - _table.add_unique_constraint::<__sats::i256>("n", |row| &row.n) + _table.add_unique_constraint::<__sats::i256>("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs index 8070f483c1..b009c18d37 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI32TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i32"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs index 8c215979bf..67fb4eea9c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI64TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i64"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs index 7ba0de61f8..f2b0024e21 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueI8TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_i8"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs index 3ec3474b2c..34a768c897 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueIdentityTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_identity"); - _table.add_unique_constraint::<__sdk::Identity>("i", |row| &row.i) + _table.add_unique_constraint::<__sdk::Identity>("i", |row| &row.i); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs index 1a67facf6c..399b0e2560 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueStringTableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_string"); - _table.add_unique_constraint::("s", |row| &row.s) + _table.add_unique_constraint::("s", |row| &row.s); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs index b3d4fe422d..2d645d34fe 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU128TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u128"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs index ee8328b5a9..9de6e170ed 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU16TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u16"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs index 605d484b6d..b127f97adb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU256TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u256"); - _table.add_unique_constraint::<__sats::u256>("n", |row| &row.n) + _table.add_unique_constraint::<__sats::u256>("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs index 60ba024fa2..1e70d775ec 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU32TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u32"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs index 4d7d77f0a0..f10368b8e3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU64TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u64"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs index 771cdfabf4..d14d70c14e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs @@ -84,7 +84,7 @@ impl<'ctx> __sdk::Table for UniqueU8TableHandle<'ctx> { #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("unique_u8"); - _table.add_unique_constraint::("n", |row| &row.n) + _table.add_unique_constraint::("n", |row| &row.n); } #[doc(hidden)] pub(super) fn parse_table_update( diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs index ccdea19088..47efac2daf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkAddress { +pub(super) struct UpdatePkAddressArgs { pub a: __sdk::Address, pub data: i32, } -impl __sdk::InModule for UpdatePkAddress { +impl From for super::Reducer { + fn from(args: UpdatePkAddressArgs) -> Self { + Self::UpdatePkAddress { + a: args.a, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkAddressArgs { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_pk_address { impl update_pk_address for super::RemoteReducers { fn update_pk_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_address", UpdatePkAddress { a, data }) + self.imp + .call_reducer("update_pk_address", UpdatePkAddressArgs { a, data }) } fn on_update_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> UpdatePkAddressCallbackId { - UpdatePkAddressCallbackId(self.imp.on_reducer::( + UpdatePkAddressCallbackId(self.imp.on_reducer( "update_pk_address", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkAddress| callback(ctx, &args.a, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkAddress { a, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, data) + }), )) } fn remove_on_update_pk_address(&self, callback: UpdatePkAddressCallbackId) { - self.imp - .remove_on_reducer::("update_pk_address", callback.0) + self.imp.remove_on_reducer("update_pk_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs index 934e54e1ce..68443e5ffe 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkBool { +pub(super) struct UpdatePkBoolArgs { pub b: bool, pub data: i32, } -impl __sdk::InModule for UpdatePkBool { +impl From for super::Reducer { + fn from(args: UpdatePkBoolArgs) -> Self { + Self::UpdatePkBool { + b: args.b, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkBoolArgs { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_bool { impl update_pk_bool for super::RemoteReducers { fn update_pk_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_bool", UpdatePkBool { b, data }) + self.imp.call_reducer("update_pk_bool", UpdatePkBoolArgs { b, data }) } fn on_update_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> UpdatePkBoolCallbackId { - UpdatePkBoolCallbackId(self.imp.on_reducer::( + UpdatePkBoolCallbackId(self.imp.on_reducer( "update_pk_bool", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkBool| callback(ctx, &args.b, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkBool { b, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b, data) + }), )) } fn remove_on_update_pk_bool(&self, callback: UpdatePkBoolCallbackId) { - self.imp.remove_on_reducer::("update_pk_bool", callback.0) + self.imp.remove_on_reducer("update_pk_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs index 5c9342942d..b0e1f0d9a1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI128 { +pub(super) struct UpdatePkI128Args { pub n: i128, pub data: i32, } -impl __sdk::InModule for UpdatePkI128 { +impl From for super::Reducer { + fn from(args: UpdatePkI128Args) -> Self { + Self::UpdatePkI128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI128Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_128 { impl update_pk_i_128 for super::RemoteReducers { fn update_pk_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i128", UpdatePkI128 { n, data }) + self.imp.call_reducer("update_pk_i128", UpdatePkI128Args { n, data }) } fn on_update_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> UpdatePkI128CallbackId { - UpdatePkI128CallbackId(self.imp.on_reducer::( + UpdatePkI128CallbackId(self.imp.on_reducer( "update_pk_i128", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_128(&self, callback: UpdatePkI128CallbackId) { - self.imp.remove_on_reducer::("update_pk_i128", callback.0) + self.imp.remove_on_reducer("update_pk_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs index 8947b66bb1..1283638b2e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI16 { +pub(super) struct UpdatePkI16Args { pub n: i16, pub data: i32, } -impl __sdk::InModule for UpdatePkI16 { +impl From for super::Reducer { + fn from(args: UpdatePkI16Args) -> Self { + Self::UpdatePkI16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI16Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_16 { impl update_pk_i_16 for super::RemoteReducers { fn update_pk_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i16", UpdatePkI16 { n, data }) + self.imp.call_reducer("update_pk_i16", UpdatePkI16Args { n, data }) } fn on_update_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> UpdatePkI16CallbackId { - UpdatePkI16CallbackId(self.imp.on_reducer::( + UpdatePkI16CallbackId(self.imp.on_reducer( "update_pk_i16", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_16(&self, callback: UpdatePkI16CallbackId) { - self.imp.remove_on_reducer::("update_pk_i16", callback.0) + self.imp.remove_on_reducer("update_pk_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs index 731b590c33..3ad6ca1082 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI256 { +pub(super) struct UpdatePkI256Args { pub n: __sats::i256, pub data: i32, } -impl __sdk::InModule for UpdatePkI256 { +impl From for super::Reducer { + fn from(args: UpdatePkI256Args) -> Self { + Self::UpdatePkI256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI256Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_256 { impl update_pk_i_256 for super::RemoteReducers { fn update_pk_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i256", UpdatePkI256 { n, data }) + self.imp.call_reducer("update_pk_i256", UpdatePkI256Args { n, data }) } fn on_update_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> UpdatePkI256CallbackId { - UpdatePkI256CallbackId(self.imp.on_reducer::( + UpdatePkI256CallbackId(self.imp.on_reducer( "update_pk_i256", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_256(&self, callback: UpdatePkI256CallbackId) { - self.imp.remove_on_reducer::("update_pk_i256", callback.0) + self.imp.remove_on_reducer("update_pk_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs index 0320695b29..9af9bf9515 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI32 { +pub(super) struct UpdatePkI32Args { pub n: i32, pub data: i32, } -impl __sdk::InModule for UpdatePkI32 { +impl From for super::Reducer { + fn from(args: UpdatePkI32Args) -> Self { + Self::UpdatePkI32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI32Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_32 { impl update_pk_i_32 for super::RemoteReducers { fn update_pk_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i32", UpdatePkI32 { n, data }) + self.imp.call_reducer("update_pk_i32", UpdatePkI32Args { n, data }) } fn on_update_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> UpdatePkI32CallbackId { - UpdatePkI32CallbackId(self.imp.on_reducer::( + UpdatePkI32CallbackId(self.imp.on_reducer( "update_pk_i32", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_32(&self, callback: UpdatePkI32CallbackId) { - self.imp.remove_on_reducer::("update_pk_i32", callback.0) + self.imp.remove_on_reducer("update_pk_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs index c534debb53..4be4fd8874 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI64 { +pub(super) struct UpdatePkI64Args { pub n: i64, pub data: i32, } -impl __sdk::InModule for UpdatePkI64 { +impl From for super::Reducer { + fn from(args: UpdatePkI64Args) -> Self { + Self::UpdatePkI64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI64Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_64 { impl update_pk_i_64 for super::RemoteReducers { fn update_pk_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i64", UpdatePkI64 { n, data }) + self.imp.call_reducer("update_pk_i64", UpdatePkI64Args { n, data }) } fn on_update_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> UpdatePkI64CallbackId { - UpdatePkI64CallbackId(self.imp.on_reducer::( + UpdatePkI64CallbackId(self.imp.on_reducer( "update_pk_i64", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_64(&self, callback: UpdatePkI64CallbackId) { - self.imp.remove_on_reducer::("update_pk_i64", callback.0) + self.imp.remove_on_reducer("update_pk_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs index 4ffe446b34..30f8b2c9af 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkI8 { +pub(super) struct UpdatePkI8Args { pub n: i8, pub data: i32, } -impl __sdk::InModule for UpdatePkI8 { +impl From for super::Reducer { + fn from(args: UpdatePkI8Args) -> Self { + Self::UpdatePkI8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkI8Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_i_8 { impl update_pk_i_8 for super::RemoteReducers { fn update_pk_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i8", UpdatePkI8 { n, data }) + self.imp.call_reducer("update_pk_i8", UpdatePkI8Args { n, data }) } fn on_update_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> UpdatePkI8CallbackId { - UpdatePkI8CallbackId(self.imp.on_reducer::( + UpdatePkI8CallbackId(self.imp.on_reducer( "update_pk_i8", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkI8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkI8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_i_8(&self, callback: UpdatePkI8CallbackId) { - self.imp.remove_on_reducer::("update_pk_i8", callback.0) + self.imp.remove_on_reducer("update_pk_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs index fe4995574f..2dfb59ddf1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkIdentity { +pub(super) struct UpdatePkIdentityArgs { pub i: __sdk::Identity, pub data: i32, } -impl __sdk::InModule for UpdatePkIdentity { +impl From for super::Reducer { + fn from(args: UpdatePkIdentityArgs) -> Self { + Self::UpdatePkIdentity { + i: args.i, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkIdentityArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_pk_identity { impl update_pk_identity for super::RemoteReducers { fn update_pk_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_pk_identity", UpdatePkIdentity { i, data }) + .call_reducer("update_pk_identity", UpdatePkIdentityArgs { i, data }) } fn on_update_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> UpdatePkIdentityCallbackId { - UpdatePkIdentityCallbackId(self.imp.on_reducer::( + UpdatePkIdentityCallbackId(self.imp.on_reducer( "update_pk_identity", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkIdentity| callback(ctx, &args.i, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkIdentity { i, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i, data) + }), )) } fn remove_on_update_pk_identity(&self, callback: UpdatePkIdentityCallbackId) { - self.imp - .remove_on_reducer::("update_pk_identity", callback.0) + self.imp.remove_on_reducer("update_pk_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs index 021e5e0885..40820feb1b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkString { +pub(super) struct UpdatePkStringArgs { pub s: String, pub data: i32, } -impl __sdk::InModule for UpdatePkString { +impl From for super::Reducer { + fn from(args: UpdatePkStringArgs) -> Self { + Self::UpdatePkString { + s: args.s, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkStringArgs { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_pk_string { impl update_pk_string for super::RemoteReducers { fn update_pk_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_string", UpdatePkString { s, data }) + self.imp + .call_reducer("update_pk_string", UpdatePkStringArgs { s, data }) } fn on_update_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> UpdatePkStringCallbackId { - UpdatePkStringCallbackId(self.imp.on_reducer::( + UpdatePkStringCallbackId(self.imp.on_reducer( "update_pk_string", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkString| callback(ctx, &args.s, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkString { s, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s, data) + }), )) } fn remove_on_update_pk_string(&self, callback: UpdatePkStringCallbackId) { - self.imp - .remove_on_reducer::("update_pk_string", callback.0) + self.imp.remove_on_reducer("update_pk_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs index 185d93eacc..a8d7ef84f9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU128 { +pub(super) struct UpdatePkU128Args { pub n: u128, pub data: i32, } -impl __sdk::InModule for UpdatePkU128 { +impl From for super::Reducer { + fn from(args: UpdatePkU128Args) -> Self { + Self::UpdatePkU128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU128Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_128 { impl update_pk_u_128 for super::RemoteReducers { fn update_pk_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u128", UpdatePkU128 { n, data }) + self.imp.call_reducer("update_pk_u128", UpdatePkU128Args { n, data }) } fn on_update_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> UpdatePkU128CallbackId { - UpdatePkU128CallbackId(self.imp.on_reducer::( + UpdatePkU128CallbackId(self.imp.on_reducer( "update_pk_u128", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_128(&self, callback: UpdatePkU128CallbackId) { - self.imp.remove_on_reducer::("update_pk_u128", callback.0) + self.imp.remove_on_reducer("update_pk_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs index 9ecc92e532..72a14537eb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU16 { +pub(super) struct UpdatePkU16Args { pub n: u16, pub data: i32, } -impl __sdk::InModule for UpdatePkU16 { +impl From for super::Reducer { + fn from(args: UpdatePkU16Args) -> Self { + Self::UpdatePkU16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU16Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_16 { impl update_pk_u_16 for super::RemoteReducers { fn update_pk_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u16", UpdatePkU16 { n, data }) + self.imp.call_reducer("update_pk_u16", UpdatePkU16Args { n, data }) } fn on_update_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> UpdatePkU16CallbackId { - UpdatePkU16CallbackId(self.imp.on_reducer::( + UpdatePkU16CallbackId(self.imp.on_reducer( "update_pk_u16", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_16(&self, callback: UpdatePkU16CallbackId) { - self.imp.remove_on_reducer::("update_pk_u16", callback.0) + self.imp.remove_on_reducer("update_pk_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs index 1cd37c873a..905c7e6805 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU256 { +pub(super) struct UpdatePkU256Args { pub n: __sats::u256, pub data: i32, } -impl __sdk::InModule for UpdatePkU256 { +impl From for super::Reducer { + fn from(args: UpdatePkU256Args) -> Self { + Self::UpdatePkU256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU256Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_256 { impl update_pk_u_256 for super::RemoteReducers { fn update_pk_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u256", UpdatePkU256 { n, data }) + self.imp.call_reducer("update_pk_u256", UpdatePkU256Args { n, data }) } fn on_update_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> UpdatePkU256CallbackId { - UpdatePkU256CallbackId(self.imp.on_reducer::( + UpdatePkU256CallbackId(self.imp.on_reducer( "update_pk_u256", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_256(&self, callback: UpdatePkU256CallbackId) { - self.imp.remove_on_reducer::("update_pk_u256", callback.0) + self.imp.remove_on_reducer("update_pk_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs index 9e5ce2507e..e79c0e15bb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU32 { +pub(super) struct UpdatePkU32Args { pub n: u32, pub data: i32, } -impl __sdk::InModule for UpdatePkU32 { +impl From for super::Reducer { + fn from(args: UpdatePkU32Args) -> Self { + Self::UpdatePkU32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU32Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_32 { impl update_pk_u_32 for super::RemoteReducers { fn update_pk_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u32", UpdatePkU32 { n, data }) + self.imp.call_reducer("update_pk_u32", UpdatePkU32Args { n, data }) } fn on_update_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> UpdatePkU32CallbackId { - UpdatePkU32CallbackId(self.imp.on_reducer::( + UpdatePkU32CallbackId(self.imp.on_reducer( "update_pk_u32", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_32(&self, callback: UpdatePkU32CallbackId) { - self.imp.remove_on_reducer::("update_pk_u32", callback.0) + self.imp.remove_on_reducer("update_pk_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs index ca407b1b8f..6ef11c0bf4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU64 { +pub(super) struct UpdatePkU64Args { pub n: u64, pub data: i32, } -impl __sdk::InModule for UpdatePkU64 { +impl From for super::Reducer { + fn from(args: UpdatePkU64Args) -> Self { + Self::UpdatePkU64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU64Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_64 { impl update_pk_u_64 for super::RemoteReducers { fn update_pk_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u64", UpdatePkU64 { n, data }) + self.imp.call_reducer("update_pk_u64", UpdatePkU64Args { n, data }) } fn on_update_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> UpdatePkU64CallbackId { - UpdatePkU64CallbackId(self.imp.on_reducer::( + UpdatePkU64CallbackId(self.imp.on_reducer( "update_pk_u64", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_64(&self, callback: UpdatePkU64CallbackId) { - self.imp.remove_on_reducer::("update_pk_u64", callback.0) + self.imp.remove_on_reducer("update_pk_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs index b0648ace8f..5e3b431296 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdatePkU8 { +pub(super) struct UpdatePkU8Args { pub n: u8, pub data: i32, } -impl __sdk::InModule for UpdatePkU8 { +impl From for super::Reducer { + fn from(args: UpdatePkU8Args) -> Self { + Self::UpdatePkU8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdatePkU8Args { type Module = super::RemoteModule; } @@ -52,19 +61,32 @@ pub trait update_pk_u_8 { impl update_pk_u_8 for super::RemoteReducers { fn update_pk_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u8", UpdatePkU8 { n, data }) + self.imp.call_reducer("update_pk_u8", UpdatePkU8Args { n, data }) } fn on_update_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> UpdatePkU8CallbackId { - UpdatePkU8CallbackId(self.imp.on_reducer::( + UpdatePkU8CallbackId(self.imp.on_reducer( "update_pk_u8", - Box::new(move |ctx: &super::EventContext, args: &UpdatePkU8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdatePkU8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_pk_u_8(&self, callback: UpdatePkU8CallbackId) { - self.imp.remove_on_reducer::("update_pk_u8", callback.0) + self.imp.remove_on_reducer("update_pk_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs index a8f961aa89..ed84ba3039 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueAddress { +pub(super) struct UpdateUniqueAddressArgs { pub a: __sdk::Address, pub data: i32, } -impl __sdk::InModule for UpdateUniqueAddress { +impl From for super::Reducer { + fn from(args: UpdateUniqueAddressArgs) -> Self { + Self::UpdateUniqueAddress { + a: args.a, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueAddressArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_address { impl update_unique_address for super::RemoteReducers { fn update_unique_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_address", UpdateUniqueAddress { a, data }) + .call_reducer("update_unique_address", UpdateUniqueAddressArgs { a, data }) } fn on_update_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> UpdateUniqueAddressCallbackId { - UpdateUniqueAddressCallbackId(self.imp.on_reducer::( + UpdateUniqueAddressCallbackId(self.imp.on_reducer( "update_unique_address", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueAddress| callback(ctx, &args.a, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueAddress { a, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, a, data) + }), )) } fn remove_on_update_unique_address(&self, callback: UpdateUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("update_unique_address", callback.0) + self.imp.remove_on_reducer("update_unique_address", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs index 3e3f6c5c8e..f1442871c8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueBool { +pub(super) struct UpdateUniqueBoolArgs { pub b: bool, pub data: i32, } -impl __sdk::InModule for UpdateUniqueBool { +impl From for super::Reducer { + fn from(args: UpdateUniqueBoolArgs) -> Self { + Self::UpdateUniqueBool { + b: args.b, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueBoolArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_bool { impl update_unique_bool for super::RemoteReducers { fn update_unique_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_bool", UpdateUniqueBool { b, data }) + .call_reducer("update_unique_bool", UpdateUniqueBoolArgs { b, data }) } fn on_update_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> UpdateUniqueBoolCallbackId { - UpdateUniqueBoolCallbackId(self.imp.on_reducer::( + UpdateUniqueBoolCallbackId(self.imp.on_reducer( "update_unique_bool", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueBool| callback(ctx, &args.b, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueBool { b, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, b, data) + }), )) } fn remove_on_update_unique_bool(&self, callback: UpdateUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("update_unique_bool", callback.0) + self.imp.remove_on_reducer("update_unique_bool", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs index 4828304307..5a4a8eb96e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI128 { +pub(super) struct UpdateUniqueI128Args { pub n: i128, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI128 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI128Args) -> Self { + Self::UpdateUniqueI128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI128Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_i_128 { impl update_unique_i_128 for super::RemoteReducers { fn update_unique_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_i128", UpdateUniqueI128 { n, data }) + .call_reducer("update_unique_i128", UpdateUniqueI128Args { n, data }) } fn on_update_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> UpdateUniqueI128CallbackId { - UpdateUniqueI128CallbackId(self.imp.on_reducer::( + UpdateUniqueI128CallbackId(self.imp.on_reducer( "update_unique_i128", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_128(&self, callback: UpdateUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i128", callback.0) + self.imp.remove_on_reducer("update_unique_i128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs index 10828595ec..de08fc045c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI16 { +pub(super) struct UpdateUniqueI16Args { pub n: i16, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI16 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI16Args) -> Self { + Self::UpdateUniqueI16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI16Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_i_16 { impl update_unique_i_16 for super::RemoteReducers { fn update_unique_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i16", UpdateUniqueI16 { n, data }) + self.imp + .call_reducer("update_unique_i16", UpdateUniqueI16Args { n, data }) } fn on_update_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> UpdateUniqueI16CallbackId { - UpdateUniqueI16CallbackId(self.imp.on_reducer::( + UpdateUniqueI16CallbackId(self.imp.on_reducer( "update_unique_i16", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_16(&self, callback: UpdateUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i16", callback.0) + self.imp.remove_on_reducer("update_unique_i16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs index 55c13405b0..71995464c8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI256 { +pub(super) struct UpdateUniqueI256Args { pub n: __sats::i256, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI256 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI256Args) -> Self { + Self::UpdateUniqueI256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI256Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_i_256 { impl update_unique_i_256 for super::RemoteReducers { fn update_unique_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_i256", UpdateUniqueI256 { n, data }) + .call_reducer("update_unique_i256", UpdateUniqueI256Args { n, data }) } fn on_update_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> UpdateUniqueI256CallbackId { - UpdateUniqueI256CallbackId(self.imp.on_reducer::( + UpdateUniqueI256CallbackId(self.imp.on_reducer( "update_unique_i256", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_256(&self, callback: UpdateUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i256", callback.0) + self.imp.remove_on_reducer("update_unique_i256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs index 2b8513841f..4c9adadb7e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI32 { +pub(super) struct UpdateUniqueI32Args { pub n: i32, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI32 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI32Args) -> Self { + Self::UpdateUniqueI32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI32Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_i_32 { impl update_unique_i_32 for super::RemoteReducers { fn update_unique_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i32", UpdateUniqueI32 { n, data }) + self.imp + .call_reducer("update_unique_i32", UpdateUniqueI32Args { n, data }) } fn on_update_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> UpdateUniqueI32CallbackId { - UpdateUniqueI32CallbackId(self.imp.on_reducer::( + UpdateUniqueI32CallbackId(self.imp.on_reducer( "update_unique_i32", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_32(&self, callback: UpdateUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i32", callback.0) + self.imp.remove_on_reducer("update_unique_i32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs index bf20cb15f8..b613e0cc82 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI64 { +pub(super) struct UpdateUniqueI64Args { pub n: i64, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI64 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI64Args) -> Self { + Self::UpdateUniqueI64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI64Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_i_64 { impl update_unique_i_64 for super::RemoteReducers { fn update_unique_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i64", UpdateUniqueI64 { n, data }) + self.imp + .call_reducer("update_unique_i64", UpdateUniqueI64Args { n, data }) } fn on_update_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> UpdateUniqueI64CallbackId { - UpdateUniqueI64CallbackId(self.imp.on_reducer::( + UpdateUniqueI64CallbackId(self.imp.on_reducer( "update_unique_i64", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_64(&self, callback: UpdateUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i64", callback.0) + self.imp.remove_on_reducer("update_unique_i64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs index 84ccb80e47..8a46e220c4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueI8 { +pub(super) struct UpdateUniqueI8Args { pub n: i8, pub data: i32, } -impl __sdk::InModule for UpdateUniqueI8 { +impl From for super::Reducer { + fn from(args: UpdateUniqueI8Args) -> Self { + Self::UpdateUniqueI8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueI8Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_i_8 { impl update_unique_i_8 for super::RemoteReducers { fn update_unique_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i8", UpdateUniqueI8 { n, data }) + self.imp + .call_reducer("update_unique_i8", UpdateUniqueI8Args { n, data }) } fn on_update_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> UpdateUniqueI8CallbackId { - UpdateUniqueI8CallbackId(self.imp.on_reducer::( + UpdateUniqueI8CallbackId(self.imp.on_reducer( "update_unique_i8", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueI8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_i_8(&self, callback: UpdateUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i8", callback.0) + self.imp.remove_on_reducer("update_unique_i8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs index e114bd262b..061fb35f5a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueIdentity { +pub(super) struct UpdateUniqueIdentityArgs { pub i: __sdk::Identity, pub data: i32, } -impl __sdk::InModule for UpdateUniqueIdentity { +impl From for super::Reducer { + fn from(args: UpdateUniqueIdentityArgs) -> Self { + Self::UpdateUniqueIdentity { + i: args.i, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueIdentityArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_identity { impl update_unique_identity for super::RemoteReducers { fn update_unique_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_identity", UpdateUniqueIdentity { i, data }) + .call_reducer("update_unique_identity", UpdateUniqueIdentityArgs { i, data }) } fn on_update_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> UpdateUniqueIdentityCallbackId { - UpdateUniqueIdentityCallbackId(self.imp.on_reducer::( + UpdateUniqueIdentityCallbackId(self.imp.on_reducer( "update_unique_identity", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueIdentity| callback(ctx, &args.i, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueIdentity { i, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, i, data) + }), )) } fn remove_on_update_unique_identity(&self, callback: UpdateUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("update_unique_identity", callback.0) + self.imp.remove_on_reducer("update_unique_identity", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs index 65c71dd6a4..9b40a07642 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueString { +pub(super) struct UpdateUniqueStringArgs { pub s: String, pub data: i32, } -impl __sdk::InModule for UpdateUniqueString { +impl From for super::Reducer { + fn from(args: UpdateUniqueStringArgs) -> Self { + Self::UpdateUniqueString { + s: args.s, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueStringArgs { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_string { impl update_unique_string for super::RemoteReducers { fn update_unique_string(&self, s: String, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_string", UpdateUniqueString { s, data }) + .call_reducer("update_unique_string", UpdateUniqueStringArgs { s, data }) } fn on_update_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> UpdateUniqueStringCallbackId { - UpdateUniqueStringCallbackId(self.imp.on_reducer::( + UpdateUniqueStringCallbackId(self.imp.on_reducer( "update_unique_string", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueString| callback(ctx, &args.s, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueString { s, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, s, data) + }), )) } fn remove_on_update_unique_string(&self, callback: UpdateUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("update_unique_string", callback.0) + self.imp.remove_on_reducer("update_unique_string", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs index f43db90213..a496503611 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU128 { +pub(super) struct UpdateUniqueU128Args { pub n: u128, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU128 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU128Args) -> Self { + Self::UpdateUniqueU128 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU128Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_u_128 { impl update_unique_u_128 for super::RemoteReducers { fn update_unique_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_u128", UpdateUniqueU128 { n, data }) + .call_reducer("update_unique_u128", UpdateUniqueU128Args { n, data }) } fn on_update_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> UpdateUniqueU128CallbackId { - UpdateUniqueU128CallbackId(self.imp.on_reducer::( + UpdateUniqueU128CallbackId(self.imp.on_reducer( "update_unique_u128", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU128| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU128 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_128(&self, callback: UpdateUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u128", callback.0) + self.imp.remove_on_reducer("update_unique_u128", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs index d8e4f89a72..95ee163266 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU16 { +pub(super) struct UpdateUniqueU16Args { pub n: u16, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU16 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU16Args) -> Self { + Self::UpdateUniqueU16 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU16Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_u_16 { impl update_unique_u_16 for super::RemoteReducers { fn update_unique_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u16", UpdateUniqueU16 { n, data }) + self.imp + .call_reducer("update_unique_u16", UpdateUniqueU16Args { n, data }) } fn on_update_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> UpdateUniqueU16CallbackId { - UpdateUniqueU16CallbackId(self.imp.on_reducer::( + UpdateUniqueU16CallbackId(self.imp.on_reducer( "update_unique_u16", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU16| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU16 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_16(&self, callback: UpdateUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u16", callback.0) + self.imp.remove_on_reducer("update_unique_u16", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs index 32003151e1..83955990a9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU256 { +pub(super) struct UpdateUniqueU256Args { pub n: __sats::u256, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU256 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU256Args) -> Self { + Self::UpdateUniqueU256 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU256Args { type Module = super::RemoteModule; } @@ -53,20 +62,32 @@ pub trait update_unique_u_256 { impl update_unique_u_256 for super::RemoteReducers { fn update_unique_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { self.imp - .call_reducer("update_unique_u256", UpdateUniqueU256 { n, data }) + .call_reducer("update_unique_u256", UpdateUniqueU256Args { n, data }) } fn on_update_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> UpdateUniqueU256CallbackId { - UpdateUniqueU256CallbackId(self.imp.on_reducer::( + UpdateUniqueU256CallbackId(self.imp.on_reducer( "update_unique_u256", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU256| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU256 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_256(&self, callback: UpdateUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u256", callback.0) + self.imp.remove_on_reducer("update_unique_u256", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs index 8a38af8812..a4ea2d15dd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU32 { +pub(super) struct UpdateUniqueU32Args { pub n: u32, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU32 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU32Args) -> Self { + Self::UpdateUniqueU32 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU32Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_u_32 { impl update_unique_u_32 for super::RemoteReducers { fn update_unique_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u32", UpdateUniqueU32 { n, data }) + self.imp + .call_reducer("update_unique_u32", UpdateUniqueU32Args { n, data }) } fn on_update_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> UpdateUniqueU32CallbackId { - UpdateUniqueU32CallbackId(self.imp.on_reducer::( + UpdateUniqueU32CallbackId(self.imp.on_reducer( "update_unique_u32", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU32| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU32 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_32(&self, callback: UpdateUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u32", callback.0) + self.imp.remove_on_reducer("update_unique_u32", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs index 75ac865075..8b0b03358c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU64 { +pub(super) struct UpdateUniqueU64Args { pub n: u64, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU64 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU64Args) -> Self { + Self::UpdateUniqueU64 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU64Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_u_64 { impl update_unique_u_64 for super::RemoteReducers { fn update_unique_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u64", UpdateUniqueU64 { n, data }) + self.imp + .call_reducer("update_unique_u64", UpdateUniqueU64Args { n, data }) } fn on_update_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> UpdateUniqueU64CallbackId { - UpdateUniqueU64CallbackId(self.imp.on_reducer::( + UpdateUniqueU64CallbackId(self.imp.on_reducer( "update_unique_u64", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU64| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU64 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_64(&self, callback: UpdateUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u64", callback.0) + self.imp.remove_on_reducer("update_unique_u64", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs index 39cb3a8bc8..72e86064f0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs @@ -9,12 +9,21 @@ use spacetimedb_sdk::__codegen::{ #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] -pub struct UpdateUniqueU8 { +pub(super) struct UpdateUniqueU8Args { pub n: u8, pub data: i32, } -impl __sdk::InModule for UpdateUniqueU8 { +impl From for super::Reducer { + fn from(args: UpdateUniqueU8Args) -> Self { + Self::UpdateUniqueU8 { + n: args.n, + data: args.data, + } + } +} + +impl __sdk::InModule for UpdateUniqueU8Args { type Module = super::RemoteModule; } @@ -52,20 +61,33 @@ pub trait update_unique_u_8 { impl update_unique_u_8 for super::RemoteReducers { fn update_unique_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u8", UpdateUniqueU8 { n, data }) + self.imp + .call_reducer("update_unique_u8", UpdateUniqueU8Args { n, data }) } fn on_update_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> UpdateUniqueU8CallbackId { - UpdateUniqueU8CallbackId(self.imp.on_reducer::( + UpdateUniqueU8CallbackId(self.imp.on_reducer( "update_unique_u8", - Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU8| callback(ctx, &args.n, &args.data)), + Box::new(move |ctx: &super::EventContext| { + let super::EventContext { + event: + __sdk::Event::Reducer(__sdk::ReducerEvent { + reducer: super::Reducer::UpdateUniqueU8 { n, data }, + .. + }), + .. + } = ctx + else { + unreachable!() + }; + callback(ctx, n, data) + }), )) } fn remove_on_update_unique_u_8(&self, callback: UpdateUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u8", callback.0) + self.imp.remove_on_reducer("update_unique_u8", callback.0) } } diff --git a/crates/sdk/tests/test-client/src/pk_test_table.rs b/crates/sdk/tests/test-client/src/pk_test_table.rs index dd7515cd4f..d113c5ed6b 100644 --- a/crates/sdk/tests/test-client/src/pk_test_table.rs +++ b/crates/sdk/tests/test-client/src/pk_test_table.rs @@ -161,13 +161,13 @@ macro_rules! impl_pk_test_table { } fn is_insert_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$insert_reducer_event(_)) + matches!(event, Reducer::$insert_reducer_event { .. }) } fn is_delete_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$delete_reducer_event(_)) + matches!(event, Reducer::$delete_reducer_event { .. }) } fn is_update_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$update_reducer_event(_)) + matches!(event, Reducer::$update_reducer_event { .. }) } fn insert(ctx: &impl RemoteDbContext, key: Self::PrimaryKey, value: i32) { diff --git a/crates/sdk/tests/test-client/src/simple_test_table.rs b/crates/sdk/tests/test-client/src/simple_test_table.rs index ce8cc3d4bc..7fafa59732 100644 --- a/crates/sdk/tests/test-client/src/simple_test_table.rs +++ b/crates/sdk/tests/test-client/src/simple_test_table.rs @@ -34,7 +34,7 @@ macro_rules! impl_simple_test_table { } fn is_insert_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$insert_reducer_event(_)) + matches!(event, Reducer::$insert_reducer_event { .. }) } fn insert(ctx: &impl RemoteDbContext, contents: Self::Contents) { diff --git a/crates/sdk/tests/test-client/src/unique_test_table.rs b/crates/sdk/tests/test-client/src/unique_test_table.rs index af3813d119..1ca1bf6500 100644 --- a/crates/sdk/tests/test-client/src/unique_test_table.rs +++ b/crates/sdk/tests/test-client/src/unique_test_table.rs @@ -113,10 +113,10 @@ macro_rules! impl_unique_test_table { } fn is_insert_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$insert_reducer_event(_)) + matches!(event, Reducer::$insert_reducer_event { .. }) } fn is_delete_reducer_event(event: &Reducer) -> bool { - matches!(event, Reducer::$delete_reducer_event(_)) + matches!(event, Reducer::$delete_reducer_event { .. }) } fn insert(ctx: &impl RemoteDbContext, key: Self::Key, value: i32) {