From 3902f7562e24c6b8ded160f02ae72d394cf6cc75 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Wed, 4 Dec 2024 16:41:16 +0000 Subject: [PATCH 1/2] Migrate C# client-side reducer enum to the new syntax (#2033) --- .github/workflows/ci.yml | 41 +- .../Autogen/RawRowLevelSecurityDefV9.cs | 4 +- .../Autogen/RawUniqueConstraintDataV9.cs | 4 +- .../Runtime/Internal/Autogen/Typespace.cs | 4 +- crates/cli/src/subcommands/generate/csharp.rs | 191 ++++---- crates/cli/src/subcommands/generate/mod.rs | 7 +- .../snapshots/codegen__codegen_csharp.snap | 425 +++++++++--------- smoketests/tests/namespaces.py | 6 +- 8 files changed, 314 insertions(+), 368 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 149fdd98aa0..ed34802f604 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,7 @@ jobs: run: | sudo mkdir /stdb sudo chmod 777 /stdb + - name: Checkout C# SDK uses: actions/checkout@v4 with: @@ -127,42 +128,18 @@ jobs: ref: staging path: spacetimedb-csharp-sdk - - name: C# SDK tests + - name: Setup NuGet override for C# SDK + working-directory: spacetimedb-csharp-sdk run: | - ( cd crates/bindings-csharp/BSATN.Runtime && dotnet pack ) - cd spacetimedb-csharp-sdk - - # Write out the nuget config file to `nuget.config`. This causes the spacetimedb-csharp-sdk repository - # to be aware of the local versions of the `bindings-csharp` packages in SpacetimeDB, and use them if - # available. Otherwise, `spacetimedb-csharp-sdk` will use the NuGet versions of the packages. - # This means that (if version numbers match) we will test the local versions of the C# packages, even - # if they're not pushed to NuGet. - # See https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file for more info on the config file, - # and https://tldp.org/LDP/abs/html/here-docs.html for more info on this bash feature. - cat >nuget.config < - - - - - - - - - - - - - - - - - - EOF + dotnet pack ../crates/bindings-csharp/BSATN.Runtime + ./tools~/write-nuget-config.sh .. # clear package caches, so we get fresh ones even if version numbers haven't changed dotnet nuget locals all --clear - dotnet test + + - name: Run C# SDK tests + working-directory: spacetimedb-csharp-sdk + run: dotnet test lints: name: Lints diff --git a/crates/bindings-csharp/Runtime/Internal/Autogen/RawRowLevelSecurityDefV9.cs b/crates/bindings-csharp/Runtime/Internal/Autogen/RawRowLevelSecurityDefV9.cs index 81c75282e85..9b8100d0741 100644 --- a/crates/bindings-csharp/Runtime/Internal/Autogen/RawRowLevelSecurityDefV9.cs +++ b/crates/bindings-csharp/Runtime/Internal/Autogen/RawRowLevelSecurityDefV9.cs @@ -18,9 +18,7 @@ public partial class RawRowLevelSecurityDefV9 [DataMember(Name = "sql")] public string Sql; - public RawRowLevelSecurityDefV9( - string Sql - ) + public RawRowLevelSecurityDefV9(string Sql) { this.Sql = Sql; } diff --git a/crates/bindings-csharp/Runtime/Internal/Autogen/RawUniqueConstraintDataV9.cs b/crates/bindings-csharp/Runtime/Internal/Autogen/RawUniqueConstraintDataV9.cs index 35abef5e88e..b02f8dc7e41 100644 --- a/crates/bindings-csharp/Runtime/Internal/Autogen/RawUniqueConstraintDataV9.cs +++ b/crates/bindings-csharp/Runtime/Internal/Autogen/RawUniqueConstraintDataV9.cs @@ -18,9 +18,7 @@ public partial class RawUniqueConstraintDataV9 [DataMember(Name = "columns")] public System.Collections.Generic.List Columns; - public RawUniqueConstraintDataV9( - System.Collections.Generic.List Columns - ) + public RawUniqueConstraintDataV9(System.Collections.Generic.List Columns) { this.Columns = Columns; } diff --git a/crates/bindings-csharp/Runtime/Internal/Autogen/Typespace.cs b/crates/bindings-csharp/Runtime/Internal/Autogen/Typespace.cs index d9978916278..bf7112ca5bd 100644 --- a/crates/bindings-csharp/Runtime/Internal/Autogen/Typespace.cs +++ b/crates/bindings-csharp/Runtime/Internal/Autogen/Typespace.cs @@ -18,9 +18,7 @@ public partial class Typespace [DataMember(Name = "types")] public System.Collections.Generic.List Types; - public Typespace( - System.Collections.Generic.List Types - ) + public Typespace(System.Collections.Generic.List Types) { this.Types = Types; } diff --git a/crates/cli/src/subcommands/generate/csharp.rs b/crates/cli/src/subcommands/generate/csharp.rs index e5048385955..6e56401028d 100644 --- a/crates/cli/src/subcommands/generate/csharp.rs +++ b/crates/cli/src/subcommands/generate/csharp.rs @@ -6,7 +6,7 @@ use std::ops::Deref; use convert_case::{Case, Casing}; use spacetimedb_lib::sats::{AlgebraicType, AlgebraicTypeRef, ArrayType, ProductType, SumType}; -use spacetimedb_lib::ReducerDef; +use spacetimedb_lib::{ProductTypeElement, ReducerDef}; use spacetimedb_primitives::ColList; use spacetimedb_schema::def::{BTreeAlgorithm, IndexAlgorithm}; use spacetimedb_schema::schema::TableSchema; @@ -265,26 +265,25 @@ pub fn autogen_csharp_sum(ctx: &GenCtx, name: &str, sum_type: &SumType, namespac } pub fn autogen_csharp_tuple(ctx: &GenCtx, name: &str, tuple: &ProductType, namespace: &str) -> String { - autogen_csharp_product_table_common(ctx, name, tuple, None, namespace) + autogen_csharp_product_common_file(ctx, name, &tuple.elements, "", namespace) } #[allow(deprecated)] pub fn autogen_csharp_table(ctx: &GenCtx, table: &TableDescHack, namespace: &str) -> String { - let tuple = ctx.typespace[table.data].as_product().unwrap(); - autogen_csharp_product_table_common( + autogen_csharp_product_common_file( ctx, csharp_typename(ctx, table.data), - tuple, - Some(table.schema.clone()), + &ctx.typespace[table.data].as_product().unwrap().elements, + "IDatabaseRow", namespace, ) } -fn autogen_csharp_product_table_common( +fn autogen_csharp_product_common_file( ctx: &GenCtx, name: &str, - product_type: &ProductType, - schema: Option, + product_type_elems: &[ProductTypeElement], + base: &str, namespace: &str, ) -> String { let mut output = CsharpAutogen::new( @@ -292,16 +291,29 @@ fn autogen_csharp_product_table_common( &["System.Collections.Generic", "System.Runtime.Serialization"], ); + autogen_csharp_product_common(ctx, &mut output, name, product_type_elems, base, namespace, |_| {}); + + output.into_inner() +} + +fn autogen_csharp_product_common( + ctx: &GenCtx, + output: &mut CodeIndenter, + name: &str, + product_type_elems: &[ProductTypeElement], + base: &str, + namespace: &str, + extra_body: impl FnOnce(&mut CodeIndenter), +) { writeln!(output, "[SpacetimeDB.Type]"); writeln!(output, "[DataContract]"); write!(output, "public partial class {name}"); - if schema.is_some() { - write!(output, " : IDatabaseRow"); + if !base.is_empty() { + write!(output, " : {base}"); } writeln!(output); - indented_block(&mut output, |output| { - let fields = product_type - .elements + indented_block(output, |output| { + let fields = product_type_elems .iter() .map(|field| { let orig_name = field @@ -321,32 +333,38 @@ fn autogen_csharp_product_table_common( }) .collect::>(); - // Generate fully-parameterized constructor. - writeln!(output); - writeln!(output, "public {name}("); - { - indent_scope!(output); - for (i, (field_name, ty)) in fields.iter().enumerate() { - if i != 0 { - writeln!(output, ","); + // If we don't have any fields, the default constructor is fine, otherwise we need to generate our own. + if !fields.is_empty() { + // Generate fully-parameterized constructor. + writeln!(output); + write!(output, "public {name}("); + if fields.len() > 1 { + writeln!(output); + } + { + indent_scope!(output); + for (i, (field_name, ty)) in fields.iter().enumerate() { + if i != 0 { + writeln!(output, ","); + } + write!(output, "{ty} {field_name}"); } - write!(output, "{ty} {field_name}"); } - } - writeln!(output); - writeln!(output, ")"); - indented_block(output, |output| { - for (field_name, _ty) in fields.iter() { - writeln!(output, "this.{field_name} = {field_name};"); + if fields.len() > 1 { + writeln!(output); } - }); - writeln!(output); + writeln!(output, ")"); + indented_block(output, |output| { + for (field_name, _ty) in fields.iter() { + writeln!(output, "this.{field_name} = {field_name};"); + } + }); + writeln!(output); - // Generate default constructor (if the one above is not already parameterless). - if !fields.is_empty() { + // Generate default constructor. writeln!(output, "public {name}()"); indented_block(output, |output| { - for ((field_name, _ty), field) in fields.iter().zip(&*product_type.elements) { + for ((field_name, _ty), field) in fields.iter().zip(product_type_elems) { if let Some(default) = default_init(ctx, &field.algebraic_type) { writeln!(output, "this.{field_name} = {default};"); } @@ -354,9 +372,9 @@ fn autogen_csharp_product_table_common( }); writeln!(output); } - }); - output.into_inner() + extra_body(output); + }); } fn indented_block(output: &mut CodeIndenter, f: impl FnOnce(&mut CodeIndenter) -> R) -> R { @@ -517,40 +535,6 @@ fn autogen_csharp_access_funcs_for_struct( } } -pub fn autogen_csharp_reducer(ctx: &GenCtx, reducer: &ReducerDef, namespace: &str) -> String { - let func_name = &*reducer.name; - let func_name_pascal_case = func_name.to_case(Case::Pascal); - - let mut output = CsharpAutogen::new(namespace, &[]); - - //Args struct - writeln!(output, "[SpacetimeDB.Type]"); - writeln!(output, "public partial class {func_name_pascal_case} : IReducerArgs"); - indented_block(&mut output, |output| { - writeln!(output, "string IReducerArgs.ReducerName => \"{func_name}\";"); - if !reducer.args.is_empty() { - writeln!(output); - } - for arg in reducer.args.iter() { - let name = arg - .name - .as_deref() - .unwrap_or_else(|| panic!("reducer args should have names: {func_name}")); - let arg_type_str = ty_fmt(ctx, &arg.algebraic_type, namespace); - let field_name = name.to_case(Case::Pascal); - - write!(output, "public {arg_type_str} {field_name}"); - // Skip default initializer if it's the same as the implicit default. - if let Some(default) = default_init(ctx, &arg.algebraic_type) { - write!(output, " = {default}"); - } - writeln!(output, ";"); - } - }); - - output.into_inner() -} - pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) -> Vec<(String, String)> { let mut results = Vec::new(); @@ -577,7 +561,14 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) .map(|reducer| reducer.name.deref().to_case(Case::Pascal)) .collect(); - let mut output = CsharpAutogen::new(namespace, &["SpacetimeDB.ClientApi", "System.Collections.Generic"]); + let mut output = CsharpAutogen::new( + namespace, + &[ + "SpacetimeDB.ClientApi", + "System.Collections.Generic", + "System.Runtime.Serialization", + ], + ); writeln!(output, "public sealed class RemoteTables"); indented_block(&mut output, |output| { @@ -665,12 +656,12 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) let delegate_separator = if !reducer.args.is_empty() { ", " } else { "" }; let mut func_params: String = String::new(); - let mut field_inits: String = String::new(); + let mut func_args: String = String::new(); for (arg_i, arg) in reducer.args.iter().enumerate() { if arg_i != 0 { func_params.push_str(", "); - field_inits.push_str(", "); + func_args.push_str(", "); } let name = arg @@ -679,10 +670,9 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) .unwrap_or_else(|| panic!("reducer args should have names: {func_name}")); let arg_type_str = ty_fmt(ctx, &arg.algebraic_type, namespace); let arg_name = name.to_case(Case::Camel); - let field_name = name.to_case(Case::Pascal); write!(func_params, "{arg_type_str} {arg_name}").unwrap(); - write!(field_inits, "{field_name} = {arg_name}").unwrap(); + write!(func_args, "{arg_name}").unwrap(); } writeln!( @@ -699,14 +689,14 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) indented_block(output, |output| { writeln!( output, - "conn.InternalCallReducer(new {func_name_pascal_case} {{ {field_inits} }}, this.SetCallReducerFlags.{func_name_pascal_case}Flags);" + "conn.InternalCallReducer(new Reducer.{func_name_pascal_case}({func_args}), this.SetCallReducerFlags.{func_name_pascal_case}Flags);" ); }); writeln!(output); writeln!( output, - "public bool Invoke{func_name_pascal_case}(EventContext ctx, {func_name_pascal_case} args)" + "public bool Invoke{func_name_pascal_case}(EventContext ctx, Reducer.{func_name_pascal_case} args)" ); indented_block(output, |output| { writeln!(output, "if (On{func_name_pascal_case} == null) return false;"); @@ -765,18 +755,31 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) }); writeln!(output); - writeln!(output, "[Type]"); - writeln!(output, "public partial record Reducer : TaggedEnum<("); - { - indent_scope!(output); - for reducer_name in &reducer_names { - writeln!(output, "{reducer_name} {reducer_name},"); + writeln!(output, "public abstract partial class Reducer"); + indented_block(&mut output, |output| { + // Prevent instantiation of this class from outside. + writeln!(output, "private Reducer() {{ }}"); + writeln!(output); + for (reducer, reducer_name) in std::iter::zip(&reducers, &reducer_names) { + let reducer_str_name = &reducer.name; + autogen_csharp_product_common( + ctx, + output, + reducer_name, + &reducer.args, + "Reducer, IReducerArgs", + namespace, + |output| { + writeln!(output, "string IReducerArgs.ReducerName => \"{reducer_str_name}\";"); + }, + ); + writeln!(output); } - writeln!(output, "Unit StdbNone,"); - writeln!(output, "Unit StdbIdentityConnected,"); - writeln!(output, "Unit StdbIdentityDisconnected"); - } - writeln!(output, ")>;"); + writeln!(output, "public class StdbNone : Reducer {{}}"); + writeln!(output, "public class StdbIdentityConnected : Reducer {{}}"); + writeln!(output, "public class StdbIdentityDisconnected : Reducer {{}}"); + }); + writeln!(output); writeln!( output, @@ -818,19 +821,19 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) let reducer_str_name = &reducer.name; writeln!( output, - "\"{reducer_str_name}\" => new Reducer.{reducer_name}(BSATNHelpers.Decode<{reducer_name}>(encodedArgs))," + "\"{reducer_str_name}\" => BSATNHelpers.Decode(encodedArgs)," ); } - writeln!(output, "\"\" => new Reducer.StdbNone(default),"); + writeln!(output, "\"\" => new Reducer.StdbNone(),"); writeln!( output, - "\"__identity_connected__\" => new Reducer.StdbIdentityConnected(default)," + "\"__identity_connected__\" => new Reducer.StdbIdentityConnected()," ); writeln!( output, - "\"__identity_disconnected__\" => new Reducer.StdbIdentityDisconnected(default)," + "\"__identity_disconnected__\" => new Reducer.StdbIdentityDisconnected()," ); - writeln!(output, "\"\" => new Reducer.StdbNone(default),"); //Transaction from CLI command + writeln!(output, "\"\" => new Reducer.StdbNone(),"); //Transaction from CLI command writeln!( output, r#"var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {{reducer}}")"# @@ -859,7 +862,7 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) for reducer_name in &reducer_names { writeln!( output, - "Reducer.{reducer_name}(var args) => Reducers.Invoke{reducer_name}(eventContext, args)," + "Reducer.{reducer_name} args => Reducers.Invoke{reducer_name}(eventContext, args)," ); } writeln!(output, "Reducer.StdbNone or"); diff --git a/crates/cli/src/subcommands/generate/mod.rs b/crates/cli/src/subcommands/generate/mod.rs index 4eb2a375952..c2b75983c2a 100644 --- a/crates/cli/src/subcommands/generate/mod.rs +++ b/crates/cli/src/subcommands/generate/mod.rs @@ -20,7 +20,6 @@ use spacetimedb_schema::def::{ModuleDef, ReducerDef, ScopedTypeName, TableDef, T use spacetimedb_schema::identifier::Identifier; use spacetimedb_schema::schema::{Schema, TableSchema}; use std::fs; -use std::ops::Deref; use std::path::{Path, PathBuf}; use wasmtime::{Caller, StoreContextMut}; @@ -367,11 +366,7 @@ impl GenItem { } _ => todo!(), }, - GenItem::Reducer(reducer) => { - let code = csharp::autogen_csharp_reducer(ctx, reducer, namespace); - let pascalcase = reducer.name.deref().to_case(Case::Pascal); - Some((pascalcase + "Reducer.cs", code)) - } + GenItem::Reducer(_) => None, } } } diff --git a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap index 2d01d0e85d2..dfc63bedf25 100644 --- a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap @@ -1,47 +1,8 @@ --- source: crates/cli/tests/codegen.rs expression: outfiles +snapshot_kind: text --- -"AddPlayerReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class AddPlayer : IReducerArgs - { - string IReducerArgs.ReducerName => "add_player"; - - public string Name = ""; - } -} -''' -"AddPrivateReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class AddPrivate : IReducerArgs - { - string IReducerArgs.ReducerName => "add_private"; - - public string Name = ""; - } -} -''' "Baz.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -62,9 +23,7 @@ namespace SpacetimeDB [DataMember(Name = "field")] public string Field; - public Baz( - string Field - ) + public Baz(string Field) { this.Field = Field; } @@ -77,46 +36,6 @@ namespace SpacetimeDB } } ''' -"DeletePlayerReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class DeletePlayer : IReducerArgs - { - string IReducerArgs.ReducerName => "delete_player"; - - public ulong Id; - } -} -''' -"DeletePlayersByNameReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class DeletePlayersByName : IReducerArgs - { - string IReducerArgs.ReducerName => "delete_players_by_name"; - - public string Name = ""; - } -} -''' "Foobar.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -322,9 +241,7 @@ namespace SpacetimeDB [DataMember(Name = "name")] public string Name; - public Private( - string Name - ) + public Private(string Name) { this.Name = Name; } @@ -337,24 +254,6 @@ namespace SpacetimeDB } } ''' -"QueryPrivateReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class QueryPrivate : IReducerArgs - { - string IReducerArgs.ReducerName => "query_private"; - } -} -''' "RepeatingTestArg.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -398,26 +297,6 @@ namespace SpacetimeDB } } ''' -"RepeatingTestReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class RepeatingTest : IReducerArgs - { - string IReducerArgs.ReducerName => "repeating_test"; - - public SpacetimeDB.RepeatingTestArg Arg = new(); - } -} -''' "TestA.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -481,9 +360,7 @@ namespace SpacetimeDB [DataMember(Name = "foo")] public string Foo; - public TestB( - string Foo - ) + public TestB(string Foo) { this.Foo = Foo; } @@ -496,24 +373,6 @@ namespace SpacetimeDB } } ''' -"TestBtreeIndexArgsReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class TestBtreeIndexArgs : IReducerArgs - { - string IReducerArgs.ReducerName => "test_btree_index_args"; - } -} -''' "TestD.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -534,9 +393,7 @@ namespace SpacetimeDB [DataMember(Name = "test_c")] public SpacetimeDB.Namespace.Types.TestC? TestC; - public TestD( - SpacetimeDB.Namespace.Types.TestC? TestC - ) + public TestD(SpacetimeDB.Namespace.Types.TestC? TestC) { this.TestC = TestC; } @@ -607,9 +464,7 @@ namespace SpacetimeDB [DataMember(Name = "field")] public SpacetimeDB.Foobar Field; - public TestFoobar( - SpacetimeDB.Foobar Field - ) + public TestFoobar(SpacetimeDB.Foobar Field) { this.Field = Field; } @@ -622,29 +477,6 @@ namespace SpacetimeDB } } ''' -"TestReducer.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -// - -#nullable enable - -using System; - -namespace SpacetimeDB -{ - [SpacetimeDB.Type] - public partial class Test : IReducerArgs - { - string IReducerArgs.ReducerName => "test"; - - public SpacetimeDB.TestA Arg = new(); - public SpacetimeDB.TestB Arg2 = new(); - public SpacetimeDB.Namespace.Types.TestC Arg3; - public SpacetimeDB.Namespace.TestF Arg4 = null!; - } -} -''' "_Globals/SpacetimeDBClient.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -655,6 +487,7 @@ namespace SpacetimeDB using System; using SpacetimeDB.ClientApi; using System.Collections.Generic; +using System.Runtime.Serialization; namespace SpacetimeDB { @@ -887,10 +720,10 @@ namespace SpacetimeDB public void AddPlayer(string name) { - conn.InternalCallReducer(new AddPlayer { Name = name }, this.SetCallReducerFlags.AddPlayerFlags); + conn.InternalCallReducer(new Reducer.AddPlayer(name), this.SetCallReducerFlags.AddPlayerFlags); } - public bool InvokeAddPlayer(EventContext ctx, AddPlayer args) + public bool InvokeAddPlayer(EventContext ctx, Reducer.AddPlayer args) { if (OnAddPlayer == null) return false; OnAddPlayer( @@ -904,10 +737,10 @@ namespace SpacetimeDB public void AddPrivate(string name) { - conn.InternalCallReducer(new AddPrivate { Name = name }, this.SetCallReducerFlags.AddPrivateFlags); + conn.InternalCallReducer(new Reducer.AddPrivate(name), this.SetCallReducerFlags.AddPrivateFlags); } - public bool InvokeAddPrivate(EventContext ctx, AddPrivate args) + public bool InvokeAddPrivate(EventContext ctx, Reducer.AddPrivate args) { if (OnAddPrivate == null) return false; OnAddPrivate( @@ -921,10 +754,10 @@ namespace SpacetimeDB public void DeletePlayer(ulong id) { - conn.InternalCallReducer(new DeletePlayer { Id = id }, this.SetCallReducerFlags.DeletePlayerFlags); + conn.InternalCallReducer(new Reducer.DeletePlayer(id), this.SetCallReducerFlags.DeletePlayerFlags); } - public bool InvokeDeletePlayer(EventContext ctx, DeletePlayer args) + public bool InvokeDeletePlayer(EventContext ctx, Reducer.DeletePlayer args) { if (OnDeletePlayer == null) return false; OnDeletePlayer( @@ -938,10 +771,10 @@ namespace SpacetimeDB public void DeletePlayersByName(string name) { - conn.InternalCallReducer(new DeletePlayersByName { Name = name }, this.SetCallReducerFlags.DeletePlayersByNameFlags); + conn.InternalCallReducer(new Reducer.DeletePlayersByName(name), this.SetCallReducerFlags.DeletePlayersByNameFlags); } - public bool InvokeDeletePlayersByName(EventContext ctx, DeletePlayersByName args) + public bool InvokeDeletePlayersByName(EventContext ctx, Reducer.DeletePlayersByName args) { if (OnDeletePlayersByName == null) return false; OnDeletePlayersByName( @@ -955,10 +788,10 @@ namespace SpacetimeDB public void QueryPrivate() { - conn.InternalCallReducer(new QueryPrivate { }, this.SetCallReducerFlags.QueryPrivateFlags); + conn.InternalCallReducer(new Reducer.QueryPrivate(), this.SetCallReducerFlags.QueryPrivateFlags); } - public bool InvokeQueryPrivate(EventContext ctx, QueryPrivate args) + public bool InvokeQueryPrivate(EventContext ctx, Reducer.QueryPrivate args) { if (OnQueryPrivate == null) return false; OnQueryPrivate( @@ -971,10 +804,10 @@ namespace SpacetimeDB public void RepeatingTest(SpacetimeDB.RepeatingTestArg arg) { - conn.InternalCallReducer(new RepeatingTest { Arg = arg }, this.SetCallReducerFlags.RepeatingTestFlags); + conn.InternalCallReducer(new Reducer.RepeatingTest(arg), this.SetCallReducerFlags.RepeatingTestFlags); } - public bool InvokeRepeatingTest(EventContext ctx, RepeatingTest args) + public bool InvokeRepeatingTest(EventContext ctx, Reducer.RepeatingTest args) { if (OnRepeatingTest == null) return false; OnRepeatingTest( @@ -988,10 +821,10 @@ namespace SpacetimeDB public void Test(SpacetimeDB.TestA arg, SpacetimeDB.TestB arg2, SpacetimeDB.Namespace.Types.TestC arg3, SpacetimeDB.Namespace.TestF arg4) { - conn.InternalCallReducer(new Test { Arg = arg, Arg2 = arg2, Arg3 = arg3, Arg4 = arg4 }, this.SetCallReducerFlags.TestFlags); + conn.InternalCallReducer(new Reducer.Test(arg, arg2, arg3, arg4), this.SetCallReducerFlags.TestFlags); } - public bool InvokeTest(EventContext ctx, Test args) + public bool InvokeTest(EventContext ctx, Reducer.Test args) { if (OnTest == null) return false; OnTest( @@ -1008,10 +841,10 @@ namespace SpacetimeDB public void TestBtreeIndexArgs() { - conn.InternalCallReducer(new TestBtreeIndexArgs { }, this.SetCallReducerFlags.TestBtreeIndexArgsFlags); + conn.InternalCallReducer(new Reducer.TestBtreeIndexArgs(), this.SetCallReducerFlags.TestBtreeIndexArgsFlags); } - public bool InvokeTestBtreeIndexArgs(EventContext ctx, TestBtreeIndexArgs args) + public bool InvokeTestBtreeIndexArgs(EventContext ctx, Reducer.TestBtreeIndexArgs args) { if (OnTestBtreeIndexArgs == null) return false; OnTestBtreeIndexArgs( @@ -1056,20 +889,164 @@ namespace SpacetimeDB } } - [Type] - public partial record Reducer : TaggedEnum<( - AddPlayer AddPlayer, - AddPrivate AddPrivate, - DeletePlayer DeletePlayer, - DeletePlayersByName DeletePlayersByName, - QueryPrivate QueryPrivate, - RepeatingTest RepeatingTest, - Test Test, - TestBtreeIndexArgs TestBtreeIndexArgs, - Unit StdbNone, - Unit StdbIdentityConnected, - Unit StdbIdentityDisconnected - )>; + public abstract partial class Reducer + { + private Reducer() { } + + [SpacetimeDB.Type] + [DataContract] + public partial class AddPlayer : Reducer, IReducerArgs + { + [DataMember(Name = "name")] + public string Name; + + public AddPlayer(string Name) + { + this.Name = Name; + } + + public AddPlayer() + { + this.Name = ""; + } + + string IReducerArgs.ReducerName => "add_player"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class AddPrivate : Reducer, IReducerArgs + { + [DataMember(Name = "name")] + public string Name; + + public AddPrivate(string Name) + { + this.Name = Name; + } + + public AddPrivate() + { + this.Name = ""; + } + + string IReducerArgs.ReducerName => "add_private"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class DeletePlayer : Reducer, IReducerArgs + { + [DataMember(Name = "id")] + public ulong Id; + + public DeletePlayer(ulong Id) + { + this.Id = Id; + } + + public DeletePlayer() + { + } + + string IReducerArgs.ReducerName => "delete_player"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class DeletePlayersByName : Reducer, IReducerArgs + { + [DataMember(Name = "name")] + public string Name; + + public DeletePlayersByName(string Name) + { + this.Name = Name; + } + + public DeletePlayersByName() + { + this.Name = ""; + } + + string IReducerArgs.ReducerName => "delete_players_by_name"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class QueryPrivate : Reducer, IReducerArgs + { + string IReducerArgs.ReducerName => "query_private"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class RepeatingTest : Reducer, IReducerArgs + { + [DataMember(Name = "arg")] + public SpacetimeDB.RepeatingTestArg Arg; + + public RepeatingTest(SpacetimeDB.RepeatingTestArg Arg) + { + this.Arg = Arg; + } + + public RepeatingTest() + { + this.Arg = new(); + } + + string IReducerArgs.ReducerName => "repeating_test"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class Test : Reducer, IReducerArgs + { + [DataMember(Name = "arg")] + public SpacetimeDB.TestA Arg; + [DataMember(Name = "arg2")] + public SpacetimeDB.TestB Arg2; + [DataMember(Name = "arg3")] + public SpacetimeDB.Namespace.Types.TestC Arg3; + [DataMember(Name = "arg4")] + public SpacetimeDB.Namespace.TestF Arg4; + + public Test( + SpacetimeDB.TestA Arg, + SpacetimeDB.TestB Arg2, + SpacetimeDB.Namespace.Types.TestC Arg3, + SpacetimeDB.Namespace.TestF Arg4 + ) + { + this.Arg = Arg; + this.Arg2 = Arg2; + this.Arg3 = Arg3; + this.Arg4 = Arg4; + } + + public Test() + { + this.Arg = new(); + this.Arg2 = new(); + this.Arg4 = null!; + } + + string IReducerArgs.ReducerName => "test"; + } + + [SpacetimeDB.Type] + [DataContract] + public partial class TestBtreeIndexArgs : Reducer, IReducerArgs + { + string IReducerArgs.ReducerName => "test_btree_index_args"; + } + + public class StdbNone : Reducer {} + public class StdbIdentityConnected : Reducer {} + public class StdbIdentityDisconnected : Reducer {} + } + public class DbConnection : DbConnectionBase { public readonly RemoteTables Db = new(); @@ -1096,18 +1073,18 @@ namespace SpacetimeDB { var encodedArgs = update.ReducerCall.Args; return update.ReducerCall.ReducerName switch { - "add_player" => new Reducer.AddPlayer(BSATNHelpers.Decode(encodedArgs)), - "add_private" => new Reducer.AddPrivate(BSATNHelpers.Decode(encodedArgs)), - "delete_player" => new Reducer.DeletePlayer(BSATNHelpers.Decode(encodedArgs)), - "delete_players_by_name" => new Reducer.DeletePlayersByName(BSATNHelpers.Decode(encodedArgs)), - "query_private" => new Reducer.QueryPrivate(BSATNHelpers.Decode(encodedArgs)), - "repeating_test" => new Reducer.RepeatingTest(BSATNHelpers.Decode(encodedArgs)), - "test" => new Reducer.Test(BSATNHelpers.Decode(encodedArgs)), - "test_btree_index_args" => new Reducer.TestBtreeIndexArgs(BSATNHelpers.Decode(encodedArgs)), - "" => new Reducer.StdbNone(default), - "__identity_connected__" => new Reducer.StdbIdentityConnected(default), - "__identity_disconnected__" => new Reducer.StdbIdentityDisconnected(default), - "" => new Reducer.StdbNone(default), + "add_player" => BSATNHelpers.Decode(encodedArgs), + "add_private" => BSATNHelpers.Decode(encodedArgs), + "delete_player" => BSATNHelpers.Decode(encodedArgs), + "delete_players_by_name" => BSATNHelpers.Decode(encodedArgs), + "query_private" => BSATNHelpers.Decode(encodedArgs), + "repeating_test" => BSATNHelpers.Decode(encodedArgs), + "test" => BSATNHelpers.Decode(encodedArgs), + "test_btree_index_args" => BSATNHelpers.Decode(encodedArgs), + "" => new Reducer.StdbNone(), + "__identity_connected__" => new Reducer.StdbIdentityConnected(), + "__identity_disconnected__" => new Reducer.StdbIdentityDisconnected(), + "" => new Reducer.StdbNone(), var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}") }; } @@ -1119,14 +1096,14 @@ namespace SpacetimeDB { var eventContext = (EventContext)context; return reducer switch { - Reducer.AddPlayer(var args) => Reducers.InvokeAddPlayer(eventContext, args), - Reducer.AddPrivate(var args) => Reducers.InvokeAddPrivate(eventContext, args), - Reducer.DeletePlayer(var args) => Reducers.InvokeDeletePlayer(eventContext, args), - Reducer.DeletePlayersByName(var args) => Reducers.InvokeDeletePlayersByName(eventContext, args), - Reducer.QueryPrivate(var args) => Reducers.InvokeQueryPrivate(eventContext, args), - Reducer.RepeatingTest(var args) => Reducers.InvokeRepeatingTest(eventContext, args), - Reducer.Test(var args) => Reducers.InvokeTest(eventContext, args), - Reducer.TestBtreeIndexArgs(var args) => Reducers.InvokeTestBtreeIndexArgs(eventContext, args), + Reducer.AddPlayer args => Reducers.InvokeAddPlayer(eventContext, args), + Reducer.AddPrivate args => Reducers.InvokeAddPrivate(eventContext, args), + Reducer.DeletePlayer args => Reducers.InvokeDeletePlayer(eventContext, args), + Reducer.DeletePlayersByName args => Reducers.InvokeDeletePlayersByName(eventContext, args), + Reducer.QueryPrivate args => Reducers.InvokeQueryPrivate(eventContext, args), + Reducer.RepeatingTest args => Reducers.InvokeRepeatingTest(eventContext, args), + Reducer.Test args => Reducers.InvokeTest(eventContext, args), + Reducer.TestBtreeIndexArgs args => Reducers.InvokeTestBtreeIndexArgs(eventContext, args), Reducer.StdbNone or Reducer.StdbIdentityConnected or Reducer.StdbIdentityDisconnected => true, diff --git a/smoketests/tests/namespaces.py b/smoketests/tests/namespaces.py index b1bd0eb268a..b6c18338830 100644 --- a/smoketests/tests/namespaces.py +++ b/smoketests/tests/namespaces.py @@ -23,7 +23,7 @@ def test_spacetimedb_ns_csharp(self): with tempfile.TemporaryDirectory() as tmpdir: self.spacetime("generate", "--out-dir", tmpdir, "--lang=cs", "--project-path", self.project_path) - self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 4) + self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 2) def test_custom_ns_csharp(self): """Ensure that when a custom namespace is specified on the command line, it actually gets used in generation""" @@ -33,5 +33,5 @@ def test_custom_ns_csharp(self): with tempfile.TemporaryDirectory() as tmpdir: self.spacetime("generate", "--out-dir", tmpdir, "--lang=cs", "--namespace", namespace, "--project-path", self.project_path) - self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 4) - self.assertEqual(count_matches(tmpdir, "using SpacetimeDB;"), 4) + self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 2) + self.assertEqual(count_matches(tmpdir, "using SpacetimeDB;"), 2) From d9de1e39430280db99941ed1871380e4f2efa041 Mon Sep 17 00:00:00 2001 From: Phoebe Goldman Date: Wed, 4 Dec 2024 12:00:27 -0500 Subject: [PATCH 2/2] Rust SDK: no more reducer args structs (#2036) --- crates/cli/src/subcommands/generate/rust.rs | 202 +- .../snapshots/codegen__codegen_rust.snap | 437 ++- .../identity_connected_reducer.rs | 33 +- .../identity_disconnected_reducer.rs | 32 +- .../module_bindings/init_reducer.rs | 31 +- .../quickstart-chat/module_bindings/mod.rs | 77 +- .../module_bindings/send_message_reducer.rs | 31 +- .../module_bindings/set_name_reducer.rs | 31 +- .../module_bindings/user_table.rs | 2 +- crates/sdk/src/callbacks.rs | 9 +- crates/sdk/src/db_connection.rs | 15 +- crates/sdk/src/spacetime_module.rs | 7 +- .../identity_connected_reducer.rs | 33 +- .../identity_disconnected_reducer.rs | 32 +- .../src/module_bindings/mod.rs | 45 +- crates/sdk/tests/test-client/src/main.rs | 20 +- .../delete_pk_address_reducer.rs | 32 +- .../module_bindings/delete_pk_bool_reducer.rs | 31 +- .../delete_pk_i_128_reducer.rs | 31 +- .../module_bindings/delete_pk_i_16_reducer.rs | 31 +- .../delete_pk_i_256_reducer.rs | 31 +- .../module_bindings/delete_pk_i_32_reducer.rs | 31 +- .../module_bindings/delete_pk_i_64_reducer.rs | 31 +- .../module_bindings/delete_pk_i_8_reducer.rs | 31 +- .../delete_pk_identity_reducer.rs | 32 +- .../delete_pk_string_reducer.rs | 32 +- .../delete_pk_u_128_reducer.rs | 31 +- .../module_bindings/delete_pk_u_16_reducer.rs | 31 +- .../delete_pk_u_256_reducer.rs | 31 +- .../module_bindings/delete_pk_u_32_reducer.rs | 31 +- .../module_bindings/delete_pk_u_64_reducer.rs | 31 +- .../module_bindings/delete_pk_u_8_reducer.rs | 31 +- .../delete_unique_address_reducer.rs | 32 +- .../delete_unique_bool_reducer.rs | 32 +- .../delete_unique_i_128_reducer.rs | 32 +- .../delete_unique_i_16_reducer.rs | 32 +- .../delete_unique_i_256_reducer.rs | 32 +- .../delete_unique_i_32_reducer.rs | 32 +- .../delete_unique_i_64_reducer.rs | 32 +- .../delete_unique_i_8_reducer.rs | 32 +- .../delete_unique_identity_reducer.rs | 32 +- .../delete_unique_string_reducer.rs | 33 +- .../delete_unique_u_128_reducer.rs | 32 +- .../delete_unique_u_16_reducer.rs | 32 +- .../delete_unique_u_256_reducer.rs | 32 +- .../delete_unique_u_32_reducer.rs | 32 +- .../delete_unique_u_64_reducer.rs | 32 +- .../delete_unique_u_8_reducer.rs | 32 +- .../insert_caller_one_address_reducer.rs | 32 +- .../insert_caller_one_identity_reducer.rs | 32 +- .../insert_caller_pk_address_reducer.rs | 32 +- .../insert_caller_pk_identity_reducer.rs | 32 +- .../insert_caller_unique_address_reducer.rs | 32 +- .../insert_caller_unique_identity_reducer.rs | 32 +- .../insert_caller_vec_address_reducer.rs | 32 +- .../insert_caller_vec_identity_reducer.rs | 32 +- .../insert_large_table_reducer.rs | 83 +- .../insert_one_address_reducer.rs | 32 +- .../insert_one_bool_reducer.rs | 32 +- .../insert_one_byte_struct_reducer.rs | 32 +- .../insert_one_enum_with_payload_reducer.rs | 32 +- ...sert_one_every_primitive_struct_reducer.rs | 35 +- .../insert_one_every_vec_struct_reducer.rs | 32 +- .../insert_one_f_32_reducer.rs | 31 +- .../insert_one_f_64_reducer.rs | 31 +- .../insert_one_i_128_reducer.rs | 32 +- .../insert_one_i_16_reducer.rs | 31 +- .../insert_one_i_256_reducer.rs | 32 +- .../insert_one_i_32_reducer.rs | 31 +- .../insert_one_i_64_reducer.rs | 31 +- .../module_bindings/insert_one_i_8_reducer.rs | 31 +- .../insert_one_identity_reducer.rs | 33 +- .../insert_one_simple_enum_reducer.rs | 32 +- .../insert_one_string_reducer.rs | 32 +- .../insert_one_u_128_reducer.rs | 32 +- .../insert_one_u_16_reducer.rs | 31 +- .../insert_one_u_256_reducer.rs | 32 +- .../insert_one_u_32_reducer.rs | 31 +- .../insert_one_u_64_reducer.rs | 31 +- .../module_bindings/insert_one_u_8_reducer.rs | 31 +- .../insert_one_unit_struct_reducer.rs | 32 +- ...t_option_every_primitive_struct_reducer.rs | 31 +- .../insert_option_i_32_reducer.rs | 32 +- .../insert_option_identity_reducer.rs | 32 +- .../insert_option_simple_enum_reducer.rs | 32 +- .../insert_option_string_reducer.rs | 33 +- .../insert_option_vec_option_i_32_reducer.rs | 32 +- .../insert_pk_address_reducer.rs | 36 +- .../module_bindings/insert_pk_bool_reducer.rs | 34 +- .../insert_pk_i_128_reducer.rs | 34 +- .../module_bindings/insert_pk_i_16_reducer.rs | 34 +- .../insert_pk_i_256_reducer.rs | 34 +- .../module_bindings/insert_pk_i_32_reducer.rs | 34 +- .../module_bindings/insert_pk_i_64_reducer.rs | 34 +- .../module_bindings/insert_pk_i_8_reducer.rs | 34 +- .../insert_pk_identity_reducer.rs | 35 +- .../insert_pk_string_reducer.rs | 36 +- .../insert_pk_u_128_reducer.rs | 34 +- .../module_bindings/insert_pk_u_16_reducer.rs | 34 +- .../insert_pk_u_256_reducer.rs | 34 +- .../module_bindings/insert_pk_u_32_reducer.rs | 34 +- .../module_bindings/insert_pk_u_64_reducer.rs | 34 +- .../module_bindings/insert_pk_u_8_reducer.rs | 34 +- .../insert_primitives_as_strings_reducer.rs | 32 +- .../insert_table_holds_table_reducer.rs | 32 +- .../insert_unique_address_reducer.rs | 35 +- .../insert_unique_bool_reducer.rs | 35 +- .../insert_unique_i_128_reducer.rs | 35 +- .../insert_unique_i_16_reducer.rs | 36 +- .../insert_unique_i_256_reducer.rs | 35 +- .../insert_unique_i_32_reducer.rs | 36 +- .../insert_unique_i_64_reducer.rs | 36 +- .../insert_unique_i_8_reducer.rs | 36 +- .../insert_unique_identity_reducer.rs | 35 +- .../insert_unique_string_reducer.rs | 35 +- .../insert_unique_u_128_reducer.rs | 35 +- .../insert_unique_u_16_reducer.rs | 36 +- .../insert_unique_u_256_reducer.rs | 35 +- .../insert_unique_u_32_reducer.rs | 36 +- .../insert_unique_u_64_reducer.rs | 36 +- .../insert_unique_u_8_reducer.rs | 36 +- .../insert_vec_address_reducer.rs | 32 +- .../insert_vec_bool_reducer.rs | 32 +- .../insert_vec_byte_struct_reducer.rs | 32 +- .../insert_vec_enum_with_payload_reducer.rs | 32 +- ...sert_vec_every_primitive_struct_reducer.rs | 35 +- .../insert_vec_every_vec_struct_reducer.rs | 32 +- .../insert_vec_f_32_reducer.rs | 31 +- .../insert_vec_f_64_reducer.rs | 31 +- .../insert_vec_i_128_reducer.rs | 32 +- .../insert_vec_i_16_reducer.rs | 31 +- .../insert_vec_i_256_reducer.rs | 32 +- .../insert_vec_i_32_reducer.rs | 31 +- .../insert_vec_i_64_reducer.rs | 31 +- .../module_bindings/insert_vec_i_8_reducer.rs | 31 +- .../insert_vec_identity_reducer.rs | 33 +- .../insert_vec_simple_enum_reducer.rs | 32 +- .../insert_vec_string_reducer.rs | 32 +- .../insert_vec_u_128_reducer.rs | 32 +- .../insert_vec_u_16_reducer.rs | 31 +- .../insert_vec_u_256_reducer.rs | 32 +- .../insert_vec_u_32_reducer.rs | 31 +- .../insert_vec_u_64_reducer.rs | 31 +- .../module_bindings/insert_vec_u_8_reducer.rs | 31 +- .../insert_vec_unit_struct_reducer.rs | 32 +- .../test-client/src/module_bindings/mod.rs | 3151 ++++++++++------- .../module_bindings/no_op_succeeds_reducer.rs | 31 +- .../src/module_bindings/pk_address_table.rs | 2 +- .../src/module_bindings/pk_bool_table.rs | 2 +- .../src/module_bindings/pk_i_128_table.rs | 2 +- .../src/module_bindings/pk_i_16_table.rs | 2 +- .../src/module_bindings/pk_i_256_table.rs | 2 +- .../src/module_bindings/pk_i_32_table.rs | 2 +- .../src/module_bindings/pk_i_64_table.rs | 2 +- .../src/module_bindings/pk_i_8_table.rs | 2 +- .../src/module_bindings/pk_identity_table.rs | 2 +- .../src/module_bindings/pk_string_table.rs | 2 +- .../src/module_bindings/pk_u_128_table.rs | 2 +- .../src/module_bindings/pk_u_16_table.rs | 2 +- .../src/module_bindings/pk_u_256_table.rs | 2 +- .../src/module_bindings/pk_u_32_table.rs | 2 +- .../src/module_bindings/pk_u_64_table.rs | 2 +- .../src/module_bindings/pk_u_8_table.rs | 2 +- .../module_bindings/unique_address_table.rs | 2 +- .../src/module_bindings/unique_bool_table.rs | 2 +- .../src/module_bindings/unique_i_128_table.rs | 2 +- .../src/module_bindings/unique_i_16_table.rs | 2 +- .../src/module_bindings/unique_i_256_table.rs | 2 +- .../src/module_bindings/unique_i_32_table.rs | 2 +- .../src/module_bindings/unique_i_64_table.rs | 2 +- .../src/module_bindings/unique_i_8_table.rs | 2 +- .../module_bindings/unique_identity_table.rs | 2 +- .../module_bindings/unique_string_table.rs | 2 +- .../src/module_bindings/unique_u_128_table.rs | 2 +- .../src/module_bindings/unique_u_16_table.rs | 2 +- .../src/module_bindings/unique_u_256_table.rs | 2 +- .../src/module_bindings/unique_u_32_table.rs | 2 +- .../src/module_bindings/unique_u_64_table.rs | 2 +- .../src/module_bindings/unique_u_8_table.rs | 2 +- .../update_pk_address_reducer.rs | 36 +- .../module_bindings/update_pk_bool_reducer.rs | 34 +- .../update_pk_i_128_reducer.rs | 34 +- .../module_bindings/update_pk_i_16_reducer.rs | 34 +- .../update_pk_i_256_reducer.rs | 34 +- .../module_bindings/update_pk_i_32_reducer.rs | 34 +- .../module_bindings/update_pk_i_64_reducer.rs | 34 +- .../module_bindings/update_pk_i_8_reducer.rs | 34 +- .../update_pk_identity_reducer.rs | 35 +- .../update_pk_string_reducer.rs | 36 +- .../update_pk_u_128_reducer.rs | 34 +- .../module_bindings/update_pk_u_16_reducer.rs | 34 +- .../update_pk_u_256_reducer.rs | 34 +- .../module_bindings/update_pk_u_32_reducer.rs | 34 +- .../module_bindings/update_pk_u_64_reducer.rs | 34 +- .../module_bindings/update_pk_u_8_reducer.rs | 34 +- .../update_unique_address_reducer.rs | 35 +- .../update_unique_bool_reducer.rs | 35 +- .../update_unique_i_128_reducer.rs | 35 +- .../update_unique_i_16_reducer.rs | 36 +- .../update_unique_i_256_reducer.rs | 35 +- .../update_unique_i_32_reducer.rs | 36 +- .../update_unique_i_64_reducer.rs | 36 +- .../update_unique_i_8_reducer.rs | 36 +- .../update_unique_identity_reducer.rs | 35 +- .../update_unique_string_reducer.rs | 35 +- .../update_unique_u_128_reducer.rs | 35 +- .../update_unique_u_16_reducer.rs | 36 +- .../update_unique_u_256_reducer.rs | 35 +- .../update_unique_u_32_reducer.rs | 36 +- .../update_unique_u_64_reducer.rs | 36 +- .../update_unique_u_8_reducer.rs | 36 +- .../tests/test-client/src/pk_test_table.rs | 6 +- .../test-client/src/simple_test_table.rs | 2 +- .../test-client/src/unique_test_table.rs | 4 +- 214 files changed, 6948 insertions(+), 2712 deletions(-) diff --git a/crates/cli/src/subcommands/generate/rust.rs b/crates/cli/src/subcommands/generate/rust.rs index fb0231938a2..f948c6760ff 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 89a0bb6c56c..45ccd008173 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 da91d7eed98..fafba96a97b 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 a902e247a72..0f48475e772 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 fda5feaaa56..50081594cf0 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 77adc0728c8..dba79d38c0f 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 c5c27e7c4a5..092afad3a84 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 48766d10d6b..f195ee29141 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 9a038444305..d0396024c2c 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 13e55eb1c1a..01175af130f 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 44d73b69c3c..ca9ffdbb289 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 68e74a050a6..1f7a1c69446 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 da91d7eed98..fafba96a97b 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 a902e247a72..0f48475e772 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 e58c81b3cad..4e8fc490e37 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 1f34fc1de32..ac98f57de1b 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 a61ab4c16e4..1bc3d87da50 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 fea91948815..7d863f3f897 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 ba84dd74ac5..68d01c64ba4 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 80c956e835c..1dc0b9eaf51 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 e57edb216d8..71a78b041f4 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 74a39f6880b..76acbb0754a 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 5f988786adb..d95f7495d51 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 9ea8b01e97f..70be2f42e3e 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 012b19933f9..438c52fcc7f 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 5a1f43ce2d3..cb91771edb4 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 b361a8ee762..e4a5d9e9ed8 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 7a449b5ec2f..3acd5a072f3 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 bb4a42adf74..5f7d227495b 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 7b36e30c6f1..374e756f88b 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 2891524b349..5fbe1323598 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 e861f53277e..de173bd2732 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 fcc75b50f0e..ab58b4c7062 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 ef258cca4b2..a253967ebf9 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 6e5886fee63..d0665f16250 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 55a9dba937e..70dc6a7d010 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 88c0728a18e..9f68fc8d61d 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 88a0ff38872..d5560698d0d 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 3f11b9067ca..73f959eebd0 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 3ddfe163727..7bc97006af3 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 23ab7bf8f14..758a08aef8f 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 72a6b0f49ed..948c8b1dbf6 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 e02d8ca60b5..ca7df9c9ac3 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 1d63daedd2e..a100b5cfb2d 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 7b04346f302..06b1872f966 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 24f13e6977d..4361cf5b709 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 50febeb576d..c27b2c51bb6 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 5f3bc05fc63..fd692c260f9 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 08a6b073e59..5adc7f39d64 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 34afdc452b2..1e8cfc2aae6 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 ccb678a48fc..a96ce8ceec8 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 85827b26f0b..cb01efde175 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 2073f6f4f5b..af19b55d52f 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 bde58d11e1f..dd0631421dc 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 cca241a9f58..ca065f2621e 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 ef7f184c09b..5632e867751 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 eaca1e5100d..8344dabaf9f 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 f396e3adcef..0b6ea59567e 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 df2498ba53d..7dc95379512 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 79aa31d40df..95fa6daf166 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 55f7cf2f282..2ff5a054ea3 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 9bc335a5091..d59c4712a29 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 29a7239485e..a42943b15a0 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 2f0413d795f..db81c7680f6 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 36da51df8c2..9f55c024afb 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 2e15665607d..5a0838c6379 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 80cd4cc9161..17da31961b0 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 d1f9091f8d8..877858eb0b4 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 d048181f83f..12ddc0eb4ef 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 774ac5fcf5b..61e4866d99e 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 46ada01498c..7dab4a81084 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 dd849c1ed9f..8b155949d2a 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 781f92bc62f..424f723d296 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 06b9e1610df..76fd9fead67 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 d2fd61c73db..c7dd6695b8b 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 e10af7a78f2..751072cdae4 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 eba92a2b13f..7064582d845 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 e55b85003de..56ffadc531b 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 b8b9ed20741..029c64eaee1 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 8e63411f99d..f11c7df20f6 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 9c59d9cdea2..3dd290d8ba2 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 f3f3786dde5..bbb164eb06b 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 16f249ba484..e0ecce5a2a2 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 9f4791f0e2d..0b6c4e4a8b8 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 b41ac61ff48..37e17334e8b 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 e678d9982ac..fc238c09d83 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 11256ed92ea..3a970569949 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 10617ed5334..61c0004fb23 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 bd5e2e2ea1d..d835aae49df 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 47e622065a3..ef1b32e33b6 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 3df97495bd0..0bcb1bcc625 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 dcf329b11fa..f4faae41b83 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 51cd4348841..1a73e884d34 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 7bdd8955a7a..aaddb742e38 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 3d889eb34b3..6dfd2f38b45 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 8b0e3657170..c5a76694058 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 715637ee173..73b3063753b 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 247783e244c..3dd088dd66a 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 18112c0817a..8d53fd031fb 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 b6e0c29cd54..d6907302cf6 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 35aec61e58a..24b1a7456b2 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 31ac5a37274..cb82f2e4ee5 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 72ffccfdfb1..fdad9f9e7e5 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 1998c5c0353..416fb4908fd 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 91d05d9f11d..2ba2fce3613 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 ed1a871eb1d..4d0d2372066 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 bd833073c9d..5b69e95a1c6 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 44cc910eee2..fc9d0426bb2 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 3c0f776bbcc..562b5df700a 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 4dd072330a5..27ef2559a88 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 aac90fba441..331b5d62ea8 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 54811779f3d..bf5d4ae2f0b 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 c235cb063a9..6ffb9227946 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 ae2add5a74e..858d4814ea7 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 eb99274902a..ec033a12478 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 2a40f8185be..c05908488dd 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 4269934a6bd..3bdeac4e448 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 c615e8b213f..b4a7116da3e 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 4b26bc18b05..449d7c73388 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 89c190bee03..a58c598f9ed 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 5f4f42ae519..ca2334ce778 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 961da98f718..781b71b490e 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 72a0ab41f2e..8818df9cba9 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 67f2736558d..56607412096 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 ec50f822272..ce7e92293a0 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 c69ad4109a5..873e2b4973f 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 5df9e874f67..db8906df8ad 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 335b3bf3192..c8ed6a79340 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 72732759129..4c5af75c89c 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 046ef457499..a04d1a52e3a 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 bdaea3325da..8169aca35f0 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 5cc19831589..209993ee6d8 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 b58b6c11b8e..24493518739 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 a4b083e649b..dfffc9bdb7a 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 0f044318afd..d3761b706cc 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 d4c128655e4..a0e92be987d 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 7f8eb61db34..13aeeb7cff7 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 d0171db6049..09568f9f201 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 0c7441db0b3..67e144a38b0 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 0c3a9dceea2..e9ebdba5f3c 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 178e01a6af3..da230809020 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 834abda58f9..747cfa50efd 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 34441d88cea..05fb5c98cd5 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 c8c1e1ae5e0..e2ddf415dab 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 27299d4252f..8c3bf8a7d7e 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 5b4b76550da..e048a98bbe2 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 35b35e1d14b..cfe9505690c 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 7451a553a19..e5d800c27f9 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 a0635b4e00b..3afec905209 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 28117bb7b5d..ddbd96bc399 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 7528ac7555d..053ee8ffa23 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 e029d5ccd95..2db2b0a3915 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 44c7cf1710b..1c282872459 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 6f5b5736374..46f31da9ae4 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 203ca8515c4..b8e5e8b1eed 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 c69958358f6..e83e6045767 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 cc7bf56fa44..987ef9d41ae 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 61fd98d57b6..0e322646b53 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 ed5c29a1c5f..c831784bea8 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 c07e466276e..c2cda6d7680 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 816d6a6fe64..5bc5f6961f6 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 3666051140d..b5320f281d5 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 9b4a64b17fa..03fdb5a319f 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 eac9a6dfa62..0529e7ca941 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 7591a6128dc..1c6eef00e4c 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 a21e6089a29..800f3288f52 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 b833204dcd2..7df0019bfde 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 af3e2903ed0..5dbec20049f 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 8070f483c13..b009c18d373 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 8c215979bf5..67fb4eea9c7 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 7ba0de61f83..f2b0024e213 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 3ec3474b2cd..34a768c8974 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 1a67facf6cb..399b0e2560a 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 b3d4fe422d3..2d645d34fe3 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 ee8328b5a97..9de6e170edd 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 605d484b6d2..b127f97adb8 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 60ba024fa27..1e70d775ece 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 4d7d77f0a04..f10368b8e3b 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 771cdfabf45..d14d70c14e2 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 ccdea190886..47efac2dafe 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 934e54e1ce5..68443e5ffec 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 5c9342942d4..b0e1f0d9a19 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 8947b66bb1c..1283638b2e8 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 731b590c33c..3ad6ca1082e 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 0320695b297..9af9bf9515b 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 c534debb53e..4be4fd88740 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 4ffe446b34d..30f8b2c9af7 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 fe4995574f7..2dfb59ddf16 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 021e5e08851..40820feb1b1 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 185d93eaccf..a8d7ef84f99 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 9ecc92e532e..72a14537eba 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 1cd37c873ad..905c7e68057 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 9e5ce2507e2..e79c0e15bbe 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 ca407b1b8f0..6ef11c0bf40 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 b0648ace8f9..5e3b4312960 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 a8f961aa89f..ed84ba30399 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 3e3f6c5c8e0..f1442871c83 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 4828304307c..5a4a8eb96e2 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 10828595ecf..de08fc045cb 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 55c13405b0f..71995464c83 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 2b8513841f9..4c9adadb7e0 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 bf20cb15f83..b613e0cc825 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 84ccb80e478..8a46e220c42 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 e114bd262b5..061fb35f5a1 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 65c71dd6a4c..9b40a076428 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 f43db902139..a496503611d 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 d8e4f89a728..95ee1632663 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 32003151e1a..83955990a9c 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 8a38af8812e..a4ea2d15dd5 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 75ac8650754..8b0b03358c3 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 39cb3a8bc8d..72e86064f09 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 dd7515cd4f6..d113c5ed6be 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 ce8cc3d4bc5..7fafa597327 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 af3813d1199..1ca1bf65005 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) {