Skip to content

Rust::com Field APIs design for rust com library#638

Draft
bharatGoswami8 wants to merge 13 commits into
eclipse-score:mainfrom
bharatGoswami8:field_API_design_Rust
Draft

Rust::com Field APIs design for rust com library#638
bharatGoswami8 wants to merge 13 commits into
eclipse-score:mainfrom
bharatGoswami8:field_API_design_Rust

Conversation

@bharatGoswami8

Copy link
Copy Markdown
Contributor

No description provided.

@bharatGoswami8 bharatGoswami8 changed the title Rust::com Field APIs design in rust com library Rust::com Field APIs design for rust com library Jul 3, 2026
* Created seperate crate for field APIs
* SampleMut updated based making common for Event and Field
* Updated SampleMut trait
* Created impl for field trait
* Updated API documentation
@bharatGoswami8
bharatGoswami8 force-pushed the field_API_design_Rust branch from 6d5faf9 to 5d851e1 Compare July 6, 2026 10:58
pub use com_api_runtime_lola::RuntimeBuilderImpl as LolaRuntimeBuilderImpl;
pub use com_api_runtime_mock::MockRuntimeImpl;
pub use com_api_runtime_mock::RuntimeBuilderImpl as MockRuntimeBuilderImpl;
// pub use com_api_runtime_mock::MockRuntimeImpl;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is just commented for now, we will enable it before PR open for review

@bharatGoswami8 bharatGoswami8 Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is not optimized yet, just for building purpose added separate field related macro implementation, will optimize this.

exhaust: Event<Exhaust>,
}
);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

macro need to be optimize.

let producer = producer_builder
.build()
.expect("Failed to build producer instance");
producer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we take initial value in FieldPublisher::new(...,value) so that field will always have default value and user no need to explicitly call update.

interface!(
interface VehicleField, {
Id = "VehicleFieldInterface",
left_tire: Field<Tire>,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

left_tire : Field<Tire, Initial_value, NotifyOnSet>

// Value return from C++ side is reference of FieldType.
let value: &Tire = producer
.left_tire
.register_set_handler()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can be done using macro parameter , in that case we need to have one more parameter for future type in producer /offerproducer struct.

Comment on lines +290 to +293
let _ = subscription
.set(Tire { pressure: 35.0 })
.expect("Failed to set field value");
let _ = subscription.get().expect("Failed to get field value");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we use with consumer instance only rather using from subscription type, in that case consumer should not move in subscribe call.

* Update the intial value for field in macro
@bharatGoswami8
bharatGoswami8 force-pushed the field_API_design_Rust branch 2 times, most recently from 1d4f5e7 to 68e8bf3 Compare July 9, 2026 06:36

// Field intialize the intial value based on the default value of the field type at the time of creating field publisher.
// If user want to update the value after that as well then they can use update method of the field publisher to update the value of the field.
interface!(

@bharatGoswami8 bharatGoswami8 Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need thread pool count for each field which can be part of macro.

left_tire : Field<Tire, Count>

@bharatGoswami8
bharatGoswami8 force-pushed the field_API_design_Rust branch from 68e8bf3 to 6dc14b7 Compare July 9, 2026 06:52
//currently we do not have MethodReturnTypePtr implementation for Lola runtime.

//If user did not get the insatnce before the subscribe call then consumer will be consumed.
let field_method = consumer.get_field_method_instance();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

consumer.left_tire.get_field_method_instance();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Left_tire_method

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