> , but I haven't seen a way to swap out the memory allocator in various contexts.
You mean something like this?
https://github.com/rust-lang/rfcs/pull/244
I think part of it was inspired by something similar from C++. D-lang also seems to have something like this.