Skip to content

Conversation

@zeenix
Copy link
Collaborator

@zeenix zeenix commented Nov 25, 2025

  • Macro now operates on a module
  • Abstract the user from signal & state change types
  • Attribute to generate client-side setters
  • Add an e2e testcase
  • Bump version

This allows the macro to have a visibility on both the struct and the
impl block and would enable us to improve the ergonomics of the API and
add new API that's currently not possible due to the decoupling between
the macro operating on the struct and impl block.
Instead provide methods to create streams for state changes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the firmware-controller macro to operate on modules instead of separate struct and impl items, improving ergonomics and enabling better coordinated code generation. The changes abstract signal and state change types from users and introduce a new pub_setter attribute for generating client-side setters.

Key Changes

  • Module-based macro design: The #[controller] attribute now applies to a module containing both the struct and impl block, enabling coordinated processing
  • Client-side pub_setter generation: New #[controller(publish(pub_setter))] attribute generates public setter methods on the client API
  • Comprehensive integration test: Added end-to-end test validating all controller features including state changes, signals, and pub_setters

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/integration.rs New comprehensive integration test demonstrating controller functionality with state management, signals, and pub_setters
src/lib.rs Refactored macro entry point to parse modules instead of individual struct/impl items
src/controller/mod.rs New module expansion logic that validates and coordinates struct/impl processing
src/controller/item_struct.rs Enhanced to return PublishedFieldInfo for coordinated impl processing and parse pub_setter attribute
src/controller/item_impl.rs Added pub_setter channel generation, client methods, and stream getter methods for published fields and signals
README.md Updated examples and documentation to reflect module-based usage and pub_setter feature
CLAUDE.md Updated architecture documentation to describe module-based processing flow
Cargo.toml Version bump to 0.3.0 and added dev dependencies for testing (futures std/executor, critical-section)
Cargo.lock Updated lock file with new dependency versions and transitive dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Published fields can now have a client-side setter method if user asks
for it through a new sub-attribute, `pub_setter`.
We're introducing breaking changes.
@zeenix zeenix merged commit 73d6f17 into layerx-world:main Nov 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants