Implement a few methods for RingBuf

Part of collections reform part 1 and 2, #18424 and #19986

* shrink_to_fit
* swap_back_remove
* swap_front_remove
* truncate
* resize
I also wonder if capacity is the right term for this? allocation size? /bikeshed