Function try_zeroed_box
pub fn try_zeroed_box<T>() -> Result<Box<T>, ()> ⓘwhere
T: Zeroable,
Available on crate feature
dep_bytemuck
only.Expand description
Allocates a Box<T>
with all of the contents being zeroed out.
This uses the global allocator to create a zeroed allocation and then turns it into a Box. In other words, it’s 100% assured that the zeroed data won’t be put temporarily on the stack. You can make a box of any size without fear of a stack overflow.
§Failure
This fails if the allocation fails.