clockworklabs / clockworklabs/SpacetimeDB

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

Open
#2,369 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or existing tests are named. Start by locating the Rust bindings macro's reducer-argument pattern handling and the generated ModuleDef path. Add the destructuring example as a test, then verify that it either fails during macro expansion or produces valid identifiers, SDK codegen, and client compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.