-
Notifications
You must be signed in to change notification settings - Fork 10
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: implement evaluation details and re-design evaluation API #24
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
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
This pr is massive 😅. I'll take a look tomorrow. |
Totally understood. Thanks for helping review it! :-D I wanted to make it small, but the changes to the core evaluation abstractions brought too many changes... |
beeme1mr
approved these changes
Sep 22, 2023
Co-authored-by: Michael Beemer <[email protected]> Signed-off-by: YUE Daian <[email protected]>
Co-authored-by: Justin Abrahms <[email protected]> Signed-off-by: YUE Daian <[email protected]>
Co-authored-by: Justin Abrahms <[email protected]> Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
beeme1mr
reviewed
Sep 25, 2023
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[email protected]>
Signed-off-by: YUE Daian <[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
get_xx_details
for the client.Result<T, EvaluationError>
andResult<EvaluationDetails<T>, EvaluationError>
forget_xx_value
andget_xx_details
respectively.default_value
parameter from the evaluation functions.Related Issues
Notes
Result<T, E>
is a powerful tool to build abstractions in Rust. By utilizing this instead of putting everything into one huge struct, we gain the following merits:The spec indicates that
default_value
should always be returned when abnormal execution. Meaning its value is passed into each function and then (conditionally) returned back. It does not make much sense because caller could simply writeclient.get_int_value(..).unwrap_or(123)
to provide123
as a default value. There is no need to put it into the function parameter and in the return value.The user could more easily decide what to do when the evaluation fails.
Result
provides many helper functions likemap
,unwrap_or
etc.Success cases and failure cases are strictly distinguished with 2 branches.
The abstractions and APIs become cleaner.
Follow-up Tasks
0.1.0
.How to test
UT.