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

Consider providing a .pop_with_value() helper on Stack and List #65

Open
Wilfred opened this issue Mar 7, 2022 · 0 comments
Open

Consider providing a .pop_with_value() helper on Stack and List #65

Wilfred opened this issue Mar 7, 2022 · 0 comments

Comments

@Wilfred
Copy link

Wilfred commented Mar 7, 2022

I find myself doing this a lot:

match foo.peek() {
  Some(head) => {
    foo = foo.pop().unwrap();
  }
}

As far as I can see, there isn't a single API for popping an item and returning it. Would it make sense to add one?

(I'm sure you can think of a better name if you do add this.)

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

No branches or pull requests

1 participant