-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add range methods to Channel and Buf #28
base: main
Are you sure you want to change the base?
Conversation
} | ||
|
||
// TODO: fix macro | ||
// iterators!(range: core::ops::Range<usize> => self.range(range.clone(()); |
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.
If you can suggest how to get the macro to accept the range.clone()
, that would allow getting rid of the boilerplate below.
fn range(self, range: impl core::ops::RangeBounds<usize>) -> Self { | ||
// Hack around trait method taking `self` rather than `mut self`. | ||
// This method returns a Self by value, so it is okay to move self | ||
// into a mut variable. | ||
let mut new = self; |
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.
Alternatively the trait method could take mut self
, but I wanted to keep the signature consistent with the skip/tail/limit methods.
Rubato uses slice ranges a lot, so this is very helpful for refactoring Rubato. |
Rebased by cherry-picking the |
ping |
on top of #13 because I'm tired of rebasing