bytemuck::allocation

Function try_zeroed_vec

source
pub fn try_zeroed_vec<T: Zeroable>(length: usize) -> Result<Vec<T>, ()>
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.