-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement throttle combinator #736
Conversation
f69bca4
to
b2f1df8
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.
Great start. I left some thoughts inline.
I'm OK w/ errors being delayed as well.
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.
Almost there 👍
Could you merge master? This will hopefully fix the CI failure. |
54b9d32
to
9524b59
Compare
Rebased. |
8df065b
to
9c3df4a
Compare
This adds get_ref, get_mut and into_inner accessors to Throttle. This is how the futures library does it as well.
@NeoLegends Can we also add a test or two for this one? Same story as the comment I left on the debounce combinator. :P |
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.
This looks great to me.
I'm happy to merge, but the PR still has [WIP]
on it. Please confirm that you are ready to have this merged and I will do so.
Yes I am. :) |
Great 👍 Thanks for sticking with it and getting this done. Looks great. |
My pleasure. Please also see #747 :) |
Second combinator implementing #732 (comment).
I'm not really sure on the design of this one (especially since errors of the underlying stream will be delayed as well, but I assume this is a necessary evil since you'd want to use this to slow down things like
stream::repeat(_)
that produce items at unbounded speeds), so I'm eager on your feedback.You might notice I added two extensions to
Stream
, one that enforces a given delay, and another one that enforces a rate of items (and calculates the required delay from that). Not sure if both are necessary, but I felt they fit quite nicely.