#[no_mangle]
pub extern "C" fn nstd_shared_ptr_size(
    shared_ptr: &NSTDSharedPtr<'_>
) -> NSTDUInt
Available on crate feature shared_ptr only.
Expand description

Returns the size of the shared object.

Parameters:

  • const NSTDSharedPtr *shared_ptr - The shared pointer.

Returns

NSTDUInt size - The size of the shared object.

Example

use nstd_sys::{
    alloc::NSTD_ALLOCATOR,
    shared_ptr::{nstd_shared_ptr_new_zeroed, nstd_shared_ptr_size},
};

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

unsafe {
    let shared_ptr = nstd_shared_ptr_new_zeroed(&NSTD_ALLOCATOR, SIZE).unwrap();
    assert!(nstd_shared_ptr_size(&shared_ptr) == SIZE);
}