Rust has a feature to drain an entire sequence,
If you do need to drain the entire sequence, use the full range,
..
, as the argument. - Programming Rust
Why would you ever need to drain the entire sequence? I can see this documented, but I don't see any use cases for this,
let mut drain = vec.drain(..);
If draining does not take ownership but clears the original structure, what's the point of not taking ownership? I thought the point of a mutable reference was because the "book was borrowed" and that you could give it back. If the original structure is cleared why not "own" the book? Why would you want to only borrow something and destroy it? It makes sense to want to borrow a subset of a vector, and clearing that subset -- but I can't seem to wrap my head around wanting to borrow the entire thing clearing the original structure.