Closed sundy-li closed 2 years ago
You can use a #[repr(C)]
struct to do this:
#[repr(C)]
struct Abc {
a: A,
b: B,
c: C,
}
let bump = Bump::new();
let abc = bump.alloc_with(|| Abc { a: foo(), b: bar(), c: baz() });
do_stuff(&mut abc.a);
I don't think this is a common enough usage pattern to warrant adding sugar to bumpalo
itself, however.
Hello, can this crate support Continuous address allocated? The function returns the first allocated reference. And we can use offset to access b and c.