devela::_dep::bytemuck::allocation

Function try_zeroed_vec

pub fn try_zeroed_vec<T>(length: usize) -> Result<Vec<T>, ()> 
where T: Zeroable,
Available on crate feature dep_bytemuck 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.