orium / rpds

Rust persistent data structures
Mozilla Public License 2.0
1.24k stars 58 forks source link

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

Open Wilfred opened 2 years ago

Wilfred commented 2 years ago

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