1 unstable release
0.1.0 | Oct 13, 2023 |
---|
#2399 in Rust patterns
3KB
push_mut
Push a value to the back of the vector, and return a mutable reference to it.
Example
use push_mut::PushMut;
fn main() {
let mut v = Vec::with_capacity(1);
let last = v.push_mut(1);
assert_eq!(*last, 1);
*last = 2;
assert_eq!(*last, 2);
}