framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.18k stars 89 forks source link

Turn `#[make_rx]` into `#[derive(ReactiveState)]` #237

Closed arctic-hen7 closed 2 years ago

arctic-hen7 commented 2 years ago

This removes the attribute macro #[make_rx] and replaces it entirely with #[derive(ReactiveState)], which achieves the exact same ends, using a derive macro. This allows for more sensible placement of the #[rx(nested)] helper macro over nested fields, while also matching neatly with the new UnreactiveState derive macro. Overall, this contributes to improved ergonomics.

This of course involves several breaking changes.

arctic-hen7 commented 2 years ago

Note that the name of the reactive version of state is now specified with the #[rx_alias = "..."] helper macro, and this provides a simple type alias. Due to greater type linkage, the underlying hidden types need never be interacted with.

arctic-hen7 commented 2 years ago

CI appears to be broken at the moment. Along with #238, I am merging this without test validation, and any errors will be sorted out in a separate PR. (I'll try to fix CI on main.)