SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Implemented newtype pattern support for tuples

Open egormanga opened this issue 5 months ago • 2 comments

Description of Changes

Related issues: #2379, #2604.

To be able to do this:

#[derive(SpacetimeType)]
pub struct Position(vecmath::Vector3<f64>);

(previously, the derive macro would panic.)

This is an early attempt! I need help in figuring out all details on how to properly implement deserialization.

Also, currently this fails with errors like these:

error at typespace ref `&1`: internal codegen error: all type elements require names: (0: Array<F64>)

error at typespace ref `&2`: internal codegen error: non-special product or sum type (0: F64, 1: Array<F64>) cannot be used to generate a client type use

API and ABI breaking changes

Unknown.

Expected complexity level and risk

?…

Testing

  • [x] SpacetimeDB compiles
  • [x] The module builds
  • [ ] ~Publishing works~

egormanga avatar Jul 19 '25 03:07 egormanga

Thank you for submitting this! We'll work on getting it reviewed (along with your other PRs)

bfops avatar Jul 21 '25 19:07 bfops

It's a bit closer now with the support for product client fields.

egormanga avatar Oct 22 '25 23:10 egormanga