Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new #[derive(IntoEngineData)] proc macro #830

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

zachschuermann
Copy link
Collaborator

@zachschuermann zachschuermann commented Apr 11, 2025

What changes are proposed in this pull request?

With the introduction of EvaluationHandler::create_one, we can create EngineData now. This PR adds a handy new procedural macro to implement a new IntoEngineData trait which allows for self.into_engine_data(&dyn Engine) as long as the struct implements ToSchema (usually via #[derive(Schema)]) and all fields implement Into<Scalar>

Few open questions:

  1. do we want to consume self and do into_engine_data(self, &engine)? I propose yes, then we can avoid copies in the case the user is actually done with the original struct.
  2. should the trait require bounds like T: ToSchema and all fields impl Into<Scalar>? where is the best place to enforce that?

How was this change tested?

new UT

Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 79.78723% with 19 lines in your changes missing coverage. Please review.

Project coverage is 85.01%. Comparing base (33f36f5) to head (52f3eda).

Files with missing lines Patch % Lines
derive-macros/src/lib.rs 72.09% 12 Missing ⚠️
kernel/src/actions/mod.rs 86.95% 6 Missing ⚠️
kernel/src/expressions/scalars.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #830      +/-   ##
==========================================
- Coverage   85.02%   85.01%   -0.01%     
==========================================
  Files          84       84              
  Lines       20637    20731      +94     
  Branches    20637    20731      +94     
==========================================
+ Hits        17546    17625      +79     
- Misses       2226     2241      +15     
  Partials      865      865              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zachschuermann zachschuermann changed the title [WIP] feat: new #[derive(IntoEngineData)] proc macro feat: new #[derive(IntoEngineData)] proc macro Apr 11, 2025
@zachschuermann zachschuermann force-pushed the derive-into-engine-data branch from 651f2db to 52f3eda Compare April 12, 2025 00:13
@github-actions github-actions bot added the breaking-change Change that will require a version bump label Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Change that will require a version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant