-
Notifications
You must be signed in to change notification settings - Fork 1
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
fea/api ergonomics #20
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mimir-d
commented
Oct 12, 2024
/// # Ok::<(), OcptvError>(()) | ||
/// # }); | ||
/// ``` | ||
pub async fn add_extension<S: serde::Serialize>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just moved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files |
- context: `end()` methods need to consume self so that the user must not use the contextual object after having emitted the end artifact. However, this introduces an issue in `scope()` methods, in that we need to pass the run object both to the async lambda and to call end, which forces the lambda to capture by reference. We cannot move into the lambda because we need to consume self in `end()`, so the lambda must receive a reference. This leads to needing to use a boxed future, because rust syntax doesn't have a way to specify captured lifetimes in async anon. - since `end()` is the only contentious method, make a new type `ScopedTestRun` which has everything except `end` and pass that with lifetime 'static into the lambda. This removes the need for the boxed future since no shorter refs are captured. Signed-off-by: mimir-d <[email protected]>
- similar to previous commit, this removes the dependency on boxed futures; remove the cargo dependency as well, and the feature flag Signed-off-by: mimir-d <[email protected]>
- this commit adds template args such that the users dont need to manually covert their values into `tv::Value` - applies for measurements, metadata and run start params Signed-off-by: mimir-d <[email protected]>
mimir-d
force-pushed
the
fea/api_ergonomics
branch
from
October 12, 2024 13:50
dbe672e
to
60b9633
Compare
njordr
approved these changes
Oct 14, 2024
- fix readme to remove boxed-scopes Signed-off-by: mimir-d <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a couple of crate api ergonomics issues:
end()
methods need to consume self so that the user mustnot use the contextual object after having emitted the end artifact.
However, this introduces an issue in
scope()
methods, in that weneed to pass the run object both to the async lambda and to call end,
which forces the lambda to capture by reference. We cannot move into
the lambda because we need to consume self in
end()
, so the lambdamust receive a reference. This leads to needing to use a boxed future,
because rust syntax doesn't have a way to specify captured lifetimes
in async anon.
end()
is the only contentious method, make a new typeScopedTestRun
which has everything exceptend
and pass that withlifetime 'static into the lambda. This removes the need for the boxed
future since no shorter refs are captured.
manually covert their values into
tv::Value