3 ms·
There could definitely be an alternate method on `Box` that returned Result, but I don't think this is so feasible for containers which allocate in many places
by dbaupp 11y ago
There could definitely be an alternate method on `Box` that returned Result, but I don't think this is so feasible for containers which allocate in many places and so would require duplicating most of the API, however there may be some tricks that work.
https://github.com/rust-lang/rfcs/issues/538 https://github.com/rust-lang/rfcs/issues/538 covers the allocator stuff.
- acconsta 11y agoRight, duplicating every method that allocates also isn't very elegant. But could Box and containers be polymorphic on an OOM handling trait? Alternatively, one could imagine an OOM-safe container that returns results, and a convenience wrapper class that unwraps them. That might harm efficient code generation though.