Function nstd_sys::vec::nstd_vec_new

source ·
#[no_mangle]
pub const extern "C" fn nstd_vec_new(
    allocator: &NSTDAllocator,
    stride: NSTDUInt
) -> NSTDVec<'_>
Available on crate feature vec only.
Expand description

Creates a new vector without allocating any resources.

Parameters:

  • const NSTDAllocator *allocator - The memory allocator.

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

Returns

NSTDVec vec - The new vector.

Example

use nstd_sys::{alloc::NSTD_ALLOCATOR, vec::nstd_vec_new};

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

let vec = unsafe { nstd_vec_new(&NSTD_ALLOCATOR, SIZE) };