SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Move macro table input region from bindings-macro to bindings

Open tamaro-skaljic opened this issue 8 months ago • 0 comments

In #2626 I have splitted the macro code in input and output regions so that it can be understood better.

I would like to propose that the input region (TableArgs and ColumnArgs parsing with there Structs) is moved to the bindings crate (https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/bindings), so devs using stdb can depend on it, to create their own code generation macros based on their tables.

The reason they can't be made public inside the bindings-macro crate instead is because proc-macro crate types currently cannot export any items other than functions tagged with #[proc_macro], #[proc_macro_derive], or #[proc_macro_attribute].

If the input part isn't made public, as an external dev you would need to copy+paste the code from the bindings-macro crate into your own derive crate or develop your own solution parse the structs annotated with #[table].

tamaro-skaljic avatar Apr 16 '25 16:04 tamaro-skaljic