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
Should we add a convenience for this like we did for copy_memory?