#push #back #mut

push_mut

Push a value to the back of the vector, and return a mutable reference to it

1 unstable release

0.1.0 Oct 13, 2023

#2118 in Rust patterns

Download history 2/week @ 2024-02-14 32/week @ 2024-02-21 17/week @ 2024-02-28 3/week @ 2024-03-06 80/week @ 2024-03-13 23/week @ 2024-03-20 29/week @ 2024-03-27 58/week @ 2024-04-03 78/week @ 2024-04-10 46/week @ 2024-04-17

229 downloads per month

MIT/Apache

3KB

push_mut

Crates.io Downloads Documentation License Dependency Status

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);   
}

No runtime deps