feat: schedule_relative! macro#921
Open
RobertJacobsonCDC wants to merge 1 commit into
Open
Conversation
Open
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
Not Compared (no baseline yet)
|
k88hudson-cfa
approved these changes
May 26, 2026
Collaborator
k88hudson-cfa
left a comment
There was a problem hiding this comment.
One suggestion but otherwise this looks good
| #[macro_export] | ||
| macro_rules! schedule_relative { | ||
| ($context:expr, $delay:expr, $action:expr $(, $arg:expr)* $(,)?) => {{ | ||
| let time = ($context).get_current_time() + $delay; |
Collaborator
There was a problem hiding this comment.
why not just assign let ctx = $context here to avoid the doube eval?
Collaborator
Author
There was a problem hiding this comment.
I should also introduce a local scope for the temporaries.
Collaborator
Author
There was a problem hiding this comment.
I should also introduce a local scope for the temporaries.
Oh, I do! 😄
a933441 to
ceec8be
Compare
ceec8be to
96cb7e2
Compare
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
Not Compared (no baseline yet)
|
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
Not Compared (no baseline yet)
|
This file contains hidden or 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
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.
Implemented a convenience macro:
expands to:
The point of the macro is:
Open Questions / Issues
track_periodic_value_change_counts(feat:track_periodic_value_change_counts!macro #917) mirrors the name of the method, so maybe we want to name thisadd_plan_relative!instead?my_delayparameter tocontext.get_current_time()for you. Maybe we should have "relative" versions of the methods for convenience as suggested by Ergonomics:add_plan()is absolute, not relative, time #836? Likewise, should there be an absolute time version of thisschedule_relative!macro, maybe calledschedule!or justadd_plan!?