orium/rpds

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

Wilfred opened this issue · 0 comments

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.)