Skip to content

Rust::com Interface declarative macro for com-api#159

Draft
bharatGoswami8 wants to merge 4 commits intoeclipse-score:mainfrom
bharatGoswami8:declarative_macro_for_interface
Draft

Rust::com Interface declarative macro for com-api#159
bharatGoswami8 wants to merge 4 commits intoeclipse-score:mainfrom
bharatGoswami8:declarative_macro_for_interface

Conversation

@bharatGoswami8
Copy link
Contributor

  • Enabled the interface and dependent type generation with macro for user

eclipse-score/score#2561

* Enabled the interface and dependent type generation with macro for user
* Moved interface macro file from macro to concept crate
* Auto ID added with Module Path
* Created lib crate root for concept module
Copy link
Contributor

@pawelrutkaq pawelrutkaq left a comment

Choose a reason for hiding this comment

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

  • doc tests

* Added document test for interface macro
@bharatGoswami8 bharatGoswami8 force-pushed the declarative_macro_for_interface branch from fa1d2b7 to 4273929 Compare February 24, 2026 10:44
* validate the ID and type generated from macro

#[doc(hidden)]
#[allow(unused_imports)]
pub use paste;
Copy link
Contributor

Choose a reason for hiding this comment

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

no external deps please.

let type_name_only = actual.split("::").last().unwrap_or("");
let expected = "VehicleInterface";
assert_eq!(type_name_only, expected, "Type name mismatch for VehicleInterface");

Copy link
Contributor

Choose a reason for hiding this comment

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

Everything above makes no sense or ? Using VehicleInterface tells you if a type has such name as you expected?


//wrong id validation
let wrong_id = "SomeInterfaceID";
assert_ne!(interface_id, wrong_id, "Interface ID should not match the wrong ID");
Copy link
Contributor

Choose a reason for hiding this comment

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

makse no sense or ? You are checking if PartialEq works for str ?


//wrong type name validation
let wrong_type_name = "SomeInterface";
assert_ne!(type_name_only, wrong_type_name, "Type name should not match the wrong type name");
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor

Choose a reason for hiding this comment

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

repeated in below tests


// Validate Producer with multiple event publishers
let producer_type = std::any::type_name::<MultiEventProducer<LolaRuntime>>();
assert!(producer_type.contains("MultiEventProducer"),
Copy link
Contributor

Choose a reason for hiding this comment

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

You dont need to compare. If yuo can reference type its is ok. And for such a tests, they are in doctest or becasue this will not compile if yuo change macro impl.

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