remem

Thread-safe object reuse.


Keywords
bytes, generic, async, mempool, native
Licenses
MIT/Apache-2.0

Documentation

remem

Utility for reusing pieces of memory

Usage

        let pool = Pool::<Vec<u8>>::new(
            || Vec::new(),
            |v| v.clear(),
        );
        let mut item = pool.get();

        item.push(1);
        item.push(2);
        item.push(3);

        drop(item);

        // item's memory can now be reused

        let mut item = pool.get();

        item.push(1);
        item.push(2);
        item.push(3);