This crate provides a special allocator of
Rc-like objects which reside close
together in memory. This is useful when you want to create a large number of
objects, but you want them close together in memory or at least know how many you
want to create in advance. Only once all of the reference counted smart pointers
and the arena are dropped, are the underlying objects dropped.
use rc_arena::Arena; let arena = Arena::new(); let foo = arena.alloc(1); let bar = arena.alloc(2); drop(arena); // objects can outlive the arena if we want let baz = foo.clone(); assert_eq!(*baz, 1);
A typed arena that provides reference-counted pointers to its underlying objects.
A reference counted pointer to an object that lives in an arena.