Function bytemuck::allocation::try_zeroed_vec

source ·
pub fn try_zeroed_vec<T: Zeroable>(length: usize) -> Result<Vec<T>, ()>
Available on crate feature extern_crate_alloc only.
Expand description

Allocates a Vec<T> of length and capacity exactly equal to length and all elements zeroed.

§Failure

This fails if the allocation fails, or if a layout cannot be calculated for the allocation.