recycle_vec 1.1.2

Provides a method for Vec to recycle it's backing allocation for use with another Vec of different type.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use recycle_vec::VecExt;

pub fn main() {
    let mut buf = Vec::with_capacity(100);
    buf.push([0_u16, 1_u16]);
    {
        let mut buf2 = buf.recycle();
        buf2.push(1_u32);
        buf = buf2.recycle();
    }
    buf.push([0_u16, 1_u16]);
}