Skip to content

Conversation

@zeenix
Copy link
Collaborator

@zeenix zeenix commented Nov 26, 2025

  • Support automatic getter generation
  • Allow setter generation independent of published attribute
  • published field streams now yield current value first
  • Drop support for old pub_setter attribute
  • README: Update as per latest changes
  • Update CLAUDE.md
  • Release 0.4

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 releases version 0.4 of the firmware-controller crate with significant improvements to the field attribute system. The release transitions from PubSubChannel to Watch-based state subscriptions, provides independent getter/setter generation, and removes the deprecated pub_setter syntax.

  • Refactored published field streams to use embassy_sync::watch::Watch channels that yield current value on first poll, then subsequent changes
  • Added new getter and setter attributes that work independently of publish, with support for custom naming
  • Removed the old pub_setter sub-attribute in favor of the new standalone setter attribute

Reviewed changes

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

Show a summary per file
File Description
tests/integration.rs Updated test attributes to use new syntax; added tests for initial stream value, custom-named getters/setters, and independent setters without publish
src/controller/mod.rs Updated function signature to pass getter and setter field collections to impl expansion
src/controller/item_struct.rs Major refactoring: introduced ControllerAttrs struct, separated parsing and code generation, added getter/setter field info structures, implemented Watch-based publishing with initial value sending
src/controller/item_impl.rs Added getter generation logic with request/response channels; updated setter generation to handle both published and non-published fields
README.md Updated examples to show new stream behavior with initial value consumption; revised API documentation for getter/setter attributes
CLAUDE.md Updated technical documentation to reflect Watch channel usage, getter/setter attributes, and new stream semantics
CHANGELOG.md Added release notes for 0.4.0 with breaking changes and new features
Cargo.toml Version bump to 0.4.0
Cargo.lock Version bump to 0.4.0

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

If `getter` attribute is specified on a field, a client getter by the same
name as the field, is generated for you. You can override the name by
specifying a string value to the `getter` attribute.
The attribute is now called `setter` and it works very similar to the
`getter` attribute. For backwards compatibility, we still allow
`pub_setter` attribute under the `published` attribute.
That is, on the first `poll_next`, they yield the current value. This is
helpful to avoid a footgun situation where a user could first get the
current value and then subscribe to changes, leading to possibly missing
out on changes in between the two operations.

Now, if you want to subscribe to changes, you just create the stream
directly and you get the current value by just calling `.next()` on it.

Breaking Changes!!!!

The stream now only yields the raw new value of the field, instead of
yielding a struct with both old and new values. If user needs to keep
the old value, they are free to do so manually.
Since we're breaking API anyway, we can just ditch this.
@zeenix zeenix merged commit 79521b2 into layerx-world:main Nov 26, 2025
3 checks passed
@zeenix zeenix deleted the rel-0.4 branch November 26, 2025 17:37
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