SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Rust bindings-macro: either reject or generate idents for reducer arguments with non-ident pattern bindings

Open bfops opened this issue 9 months ago • 0 comments

The following reducer should either be a macro-expand-time error, or result in a valid ModuleDef with some valid, locally-unique Identifiers as the argument names:

#[derive(SpacetimeType)]
struct SomeProduct {
  a: i32,
  b: i32,
}

#[reducer]
fn foo(_: &ReducerContext, _: i32, SomeProduct { a, b }: SomeProduct) {
  log::info!("{}", a + b);
}

Bonus points: add the above as a test, including valid SDK codegen and client compilation.

bfops avatar Mar 07 '25 18:03 bfops