Skip to content

Rust::com Field and Method Rust Design and Example of APIs usage - #818

Open
bharatGoswami8 wants to merge 27 commits into
eclipse-score:mainfrom
bharatGoswami8:Rust_Field_and_Method_APIs
Open

Rust::com Field and Method Rust Design and Example of APIs usage#818
bharatGoswami8 wants to merge 27 commits into
eclipse-score:mainfrom
bharatGoswami8:Rust_Field_and_Method_APIs

Conversation

@bharatGoswami8

Copy link
Copy Markdown
Contributor

For Method and Field Design following things added -

  • Field subscribe/receive (FieldSubscriber, FieldSubscription traits): a consumer can subscribe to a field, receive value updates.

  • Field publish/update (FieldPublisher trait): a producer can update() a field value, register a set handler (called when a consumer sets the field), and register a get handler.

  • Field get/set on the consumer side reuse Method infrastructure: get_{name}() / set_{name}() async helpers are generated by the interface! macro using MethodCaller there is no separate field-get/set trait.

  • Method traits (MethodHandler for producer, MethodCaller for consumer): supports up to 8 arguments via tuple-based arities, with both copy and zero-copy call paths.

  • Type-state derive macro (#[derive(TypeStateValidator)]): generates compile-time state transitions so a producer struct cannot call offer() before all fields are initialized and all handlers are registered.

  • Interface macros split into producer and consumer: interface_producer_macros.rs generates the skeleton struct with all fields/methods/events; interface_consumer_macros.rs generates the proxy struct.

  • Runtime stub added to build the APIs example usage.

  • Example app with field_producer.rs, field_consumer.rs, method_producer.rs, method_consumer.rs modules showing the API usage end-to-end.

  • Design documents and diagrams for both Field and Method architecture added.

#579

* Created Method related interface traits
* Updated Interface macro
* created method related macro
* For generating type state pattern for method and field
* Validating offer API call
* Added impl block for method interface
* Added impl block for method interface traits
* Added method api usage in example app
* Updated concept crate documentation
* Updated interface macro document
* Update type state macro document
* Updated return value to MethodReturnSample
* Added design markdown file and diagrams
* Added MethodReturnSample for returning value at consumer side
* MethodInArgPtr trait added for argument type
* Created field interface APIs
* Updated SampleMut to use in field as well
* Lola Runtime placeholder implementaion for field producer and consumer
* Mock Runtime placeholder implementation
* Create proc macro for field init and set handler validation before offer call
* Updated example file with Field APIs usage
* Method and field both code generation added on macros
- Combined Field APIs design and example of usage from PR eclipse-score#700
- Combined Method Rust APIs design and Example usage from PR eclipse-score#777
- Resolved merge conflicts keeping both Field and Method additions
* Removed the separate set-get method and introduced field method using Method interface
* Added Getter, Setter, Notifier tag for field feature to enable
* Create separate file for Producer and Consumer interface macro
* Updated set and get APIs for registration
* Updated tags for field to generate the field specific methods
* Updated intefrca macro as well
* Created trait level document design
* document for field desing
@bharatGoswami8
bharatGoswami8 force-pushed the Rust_Field_and_Method_APIs branch from c5cf7de to 0920265 Compare July 31, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant