Function nstd_sys::core::ptr::nstd_core_ptr_get
source · #[no_mangle]
pub const extern "C" fn nstd_core_ptr_get(ptr: &NSTDPtr) -> NSTDAnyAvailable on crate feature
core only.Expand description
Returns a raw immutable pointer to the object pointed to by ptr.
Parameters:
const NSTDPtr *ptr- The higher level pointer.
Returns
NSTDAny raw - A raw pointer to the object.
Examples
use core::ptr::addr_of;
use nstd_sys::core::ptr::{nstd_core_ptr_get, nstd_core_ptr_new};
unsafe {
const VALUE_SIZE: usize = core::mem::size_of::<u32>();
let x = 45u32;
let ptr = nstd_core_ptr_new(addr_of!(x).cast(), VALUE_SIZE).unwrap();
assert!(*nstd_core_ptr_get(&ptr).cast::<u32>() == x);
}