-
Notifications
You must be signed in to change notification settings - Fork 201
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
Improve watchdog API design using move semantics #222
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @therealprof (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR. It looks good to me on first glance but I need to find time for a deeper review. Two comments off the bat since you're touching this:
|
@therealprof Thank you! I've modified texts to avoid this word on dogs 😅 And additional documents are added to make it clear that, most watchdogs do not support disable process. |
A shortcoming of this approach is that a naive implementation of |
@eldruin Thanks for comment! :) You're right, it's somehow tricky in error handling for failable type state classes. Seems like the only way is to return value in error type, but if I'm correct, this is common on Rust's std crate. For example if a |
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.
I added a couple comments but otherwise looks good to me.
@luojia65 could you rebase this to master and add an entry to the changelog?
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.
Thanks so far :)
I rephrased the changelog entry a bit to make it a bit clearer that the changes are not additional but the API has changed. Would this be fine with you @luojia65?
Additionally, could you squash the changes into one commit?
f8f4f61
to
538583c
Compare
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com> Co-authored-by: Daniel Egger <@therealprof:matrix.org>
538583c
to
8a7500b
Compare
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.
Alright, this looks fine to me now.
Thank you @luojia65!
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.
LGTM!
bors r+ |
This pull request improved watchdog API design. When starting watchdog, we may convert it into another type. We may implement different functions for this type. Or downstream developers can implement
Watchdog
for only an enabled type, to prevent feed to disabled watchdogs or forget to enable before feeding. If we are able to stop this watchdog, it can be converted into the former type.If current design still need a same type after the watchdog is enabled, they may use
Target = Self
. In this way we create a fallback for earlier designs.A simple proof of concept: here (L120-L153 for its
Enable
implementation, and there isDisable
implementation)Related issue: #98
Earlier discussion: #76 (comment)