It sounds like you want the typed arena crate, which is stable and can be used in Rust 1.0.
extern crate typed_arena; #[derive(Debug)] struct Foo { a: u8, b: u8, } fn main() { let allocator = typed_arena::Arena::new(); let f = allocator.alloc(Foo { a: 42, b: 101 }); println!("{:?}", f) }
This does have limitations - all the objects must be the same. In my usage, I have a very small set of types that I wish to have, so I have just created a set of Arenas, one for each type.
If that isn't suitable, you can look to arena::Arena, which is unstable and slower than a typed arena.
The basic premise of both allocators is simple - you allow the arena to consume an item and it moves the bits around to its own memory allocation.
Another meaning for the word "allocator" is what is used when you box a value. It is planned that Rust will gain support for "placement new" at some point, and the box syntax is reserved for that.
In unstable versions of Rust, you can do something like box Foo(42), and a (hypothetical) enhancement to that would allow you to say something like box my_arena Foo(42), which would use the specified allocator. This capability is a few versions away from existing it seems.