boxing-arena

Crates.ioboxing-arena
lib.rsboxing-arena
version0.9.3
sourcesrc
created_at2020-01-14 21:05:50.61246
updated_at2020-01-21 15:05:16.440719
descriptionSimple reuse of Box allocation
homepagehttps://github.com/da-x/boxing-arena
repositoryhttps://github.com/da-x/boxing-arena
max_upload_size
id198417
size21,887
Dan Aloni (da-x)

documentation

README

The boxing-arena crate provides a very simply reuse of Box allocation by keeping a vector of reusable Box allocations that can be used when wanting to wrap a value in Box.

It would be sometimes easier to introduce boxing-arena in code bases where Box is already used extensively than to use some other arena crate that affects type and life-time semantics more drastically.

Basic usage demonstration:

// Prepare a long-lived arena:
let mut ba = BoxingArena::new();

// ... per allocation ... :

// Instead of using `Box::new` directly, we do:
let boxed_big_value = ba.rebox(big_value);

// Instead of letting Rust drop and deallocate the Box, we do:
ba.unbox(boxed_big_value);
Commit count: 4

cargo fmt