nstd_vec_reserved

Function nstd_vec_reserved 

Source
#[unsafe(no_mangle)]
pub const extern "C" fn nstd_vec_reserved( vec: &NSTDVec<'_>, ) -> NSTDUInt
Available on crate feature vec only.
Expand description

Returns the number of reserved elements within a vector’s inactive buffer.

§Parameters:

  • const NSTDVec *vec - The vector.

§Returns

NSTDUInt reserved - The number of uninitialized elements within vec’s inactive buffer.

§Example

use nstd_sys::{
    alloc::NSTD_ALLOCATOR,
    vec::{nstd_vec_new_with_cap, nstd_vec_reserved},
};

unsafe {
    let vec = nstd_vec_new_with_cap(&NSTD_ALLOCATOR, 8, 2, 16).unwrap();
    assert!(nstd_vec_reserved(&vec) == 16);
}