4 ms·
Well, their original stated problem was just invoking size_of() at runtime, which lazy-static solves. That said, Rust supports custom allocators now: https://
by bascule 9y ago
Well, their original stated problem was just invoking size_of() at runtime, which lazy-static solves.
That said, Rust supports custom allocators now:
https://doc.rust-lang.org/book/custom-allocators.html https://doc.rust-lang.org/book/custom-allocators.html
Write your own allocator and use Box.
- rkangel 9y agoI think you misunderstand what 'statically allocate' means. That means a size known at compile time, so that the space for that variable can be assigned in the memory map of the executable. Anything involving a 'custom allocator' is doing runtime memory allocation.