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

feat(utils): extract_if backport #40

Merged
merged 1 commit into from
Oct 1, 2024
Merged

feat(utils): extract_if backport #40

merged 1 commit into from
Oct 1, 2024

Conversation

sinui0
Copy link
Member

@sinui0 sinui0 commented Sep 22, 2024

This PR replaces our existing FilterDrain, backporting the std implementation of extract_if until it reaches stabilization.

Source code is directly copied (minus renaming) including the tests.

Copy link
Member

@th4s th4s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

where
F: FnMut(&mut T) -> bool,
{
pub(super) vec: &'a mut Vec<T>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not need pub(super) here, because we create FilterDrainIter in the same module.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copy pasted exactly from the std source, it should be fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end it doesn't matter, but you use a trait in the same module to instantiate it, while the standard library does the instantiation in the super module.

@sinui0 sinui0 merged commit 83a9554 into dev Oct 1, 2024
2 checks passed
@sinui0 sinui0 deleted the feat/extract_if_backport branch October 1, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants