Function nstd_sys::vec::nstd_vec_new

source ·
#[no_mangle]
pub extern "C" fn nstd_vec_new(element_size: NSTDUInt) -> NSTDVec
Available on crate feature nstd_vec only.
Expand description

Creates a new vector without allocating any resources.

Parameters:

  • NSTDUInt element_size - The size in bytes of each value in the vector.

Returns

NSTDVec vec - The new vector.

Panics

This function will panic if element_size is zero.

Example

use nstd_sys::vec::nstd_vec_new;

const SIZE: usize = core::mem::size_of::<u32>();

let vec = nstd_vec_new(SIZE);