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

drain_filter #45

Open
2 tasks
Lokathor opened this issue Jan 24, 2020 · 2 comments
Open
2 tasks

drain_filter #45

Lokathor opened this issue Jan 24, 2020 · 2 comments
Labels
Enhancement New feature or request Nightly Stuff that requires Nightly

Comments

@Lokathor
Copy link
Owner

Lokathor commented Jan 24, 2020

  • ArrayVec
  • TinyVec

Waiting on rust-lang/rust#43244, though we could add this behind a feature gate before that if we like.

@Lokathor Lokathor added Nightly Stuff that requires Nightly Enhancement New feature or request labels Jan 24, 2020
@Kixiron
Copy link

Kixiron commented Oct 24, 2021

You don't strictly need to wait for nightly to do this, for the Vec side of things (unless the feature is enabled) you could simply use the "manual" version of .drain_filter()

let mut idx = 0;
while idx < vec.get().len() {
    if vec[idx] == input {
        vec.remove(idx);
    } else {
        idx += 1;
    }
}

@Soveu
Copy link
Contributor

Soveu commented Oct 24, 2021

In case of TinyVec, drain_filter = partition + drain(partition_point..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Nightly Stuff that requires Nightly
Projects
None yet
Development

No branches or pull requests

3 participants