Skip to content
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 peek_while(predicate) #18

Open
foresterre opened this issue Sep 12, 2019 · 1 comment
Open

add peek_while(predicate) #18

foresterre opened this issue Sep 12, 2019 · 1 comment
Labels
A-high-level-api Area: for API's where the queue buffer management is handled internally C-enhancement good first issue Github global label for issues and PRs for new contributors. Always also use: status = help-wanted Hacktoberfest help wanted Github global label for issues and PRs for new contributors. Always also use: status = help-wanted S-help-wanted

Comments

@foresterre
Copy link
Owner

No description provided.

@foresterre foresterre added A-tools C-enhancement good first issue Github global label for issues and PRs for new contributors. Always also use: status = help-wanted Hacktoberfest help wanted Github global label for issues and PRs for new contributors. Always also use: status = help-wanted S-help-wanted and removed kind = enhancement labels Aug 26, 2020
@foresterre foresterre added A-high-level-api Area: for API's where the queue buffer management is handled internally and removed A-tools labels Sep 4, 2020
@ForgottenMaster
Copy link
Contributor

Just wondering about the intended semantics for peek_while. I think it's intended to be a similar API or return type as peek_range?

So the signature would be something like the following:

pub fn peek_while(&mut self, predicate: impl Fn(&I::Item) -> bool) -> &[Option<I::Item>]

Essentially will run through the iterator from the cursor position to find the position of the first element that doesn't satisfy the predicate anymore, getting all the items into the queue in the process

Then we just can do a peek_range from the cursor position to that end position to take the slice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-high-level-api Area: for API's where the queue buffer management is handled internally C-enhancement good first issue Github global label for issues and PRs for new contributors. Always also use: status = help-wanted Hacktoberfest help wanted Github global label for issues and PRs for new contributors. Always also use: status = help-wanted S-help-wanted
Projects
None yet
Development

No branches or pull requests

2 participants