Skip to main content

try_alloc_vec

Function try_alloc_vec 

Source
pub fn try_alloc_vec<T: Default + Clone>(
    len: usize,
) -> Result<Vec<T>, TryNewError>
Expand description

Convenience helper to allocate a default-initialized Vec of a given length, handling memory allocation failure gracefully.

§Arguments:

  • len - The length to resize the Vec to.

§Errors: