-
-
Notifications
You must be signed in to change notification settings - Fork 35
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: Add std support for no-std without global rand seed #169
Conversation
backon/src/backoff/mod.rs
Outdated
@@ -12,3 +12,24 @@ pub use fibonacci::FibonacciBuilder; | |||
mod exponential; | |||
pub use exponential::ExponentialBackoff; | |||
pub use exponential::ExponentialBuilder; | |||
|
|||
trait Random { |
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.
Hi, I don't want to introduce a new trait for this. Maybe we can store a new fastrand::Rng
in every FibonacciBackoff
?
Because of jitter, a random source is needed in all three Backoff Objects. That is why I used the trait. It is not just the FibonacciBackoff that needs randomness. Considering this, I think it makes sense to use a trait in order to avoid duplication. But please, tell me how you want to proceed. |
Reduced use of alloc to tests, this makes backon even better suitable for no_std |
Thank you for the explanation.
I think we can store a With this change, we no longer need to differentiate between |
I removed the trait and integrated the Rng as you suggested. Does this meet your expectations? |
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.
Thank you @wackazong for this! It mostly aligns with what I expected, with only a few minor suggestions.
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.
Thank you @wackazong a lot for working on this. The only thing left is to address the merge conflicts.
Hi @wackazong, the conflict persists even after |
Ok, got it now. |
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.
Thank you @wackazong, let's move!
Split Xuanwo#168 into two PRs as requested, this is the one for no_std support. --------- Co-authored-by: Xuanwo <[email protected]>
Split Xuanwo#168 into two PRs as requested, this is the one for no_std support. --------- Co-authored-by: Xuanwo <[email protected]>
Split #168 into two PRs as requested, this is the one for no_std support.