I don't understand why Vec::peek_mut is needed
⚓ Rust 📅 2026-02-23 👤 surdeus 👁️ 3What is the rationale for Vec::peek_mut ?
It seems to me that last_mut( available via Deref trait) has the same functionality ( it returns a mut ref to the last element, or None if the Vec is empty ).
What am I missing?
[ Well it actually returns a PeekMut struct, I guess it has something to do with that, and the pop method in that, but I am still having trouble seeing why it is useful ]
12 posts - 5 participants
🏷️ Rust_feed