pub struct ObjectHandle(/* private fields */);
Expand description
An object handle, granting access to object memory. An object handle can be in two modes:
- Owning – the normal mode, which acts like an Arc, and asks the runtime to unmap when refcount hits zero.
- Unsafe – internal use only, is NOT owning, but still has pointers. This is totally unsafe to use, and should not be exposed to users. But sometimes, it can be safe, and faster than cloning. … anyway, in general these have reference counting semantics, via Clone and Drop, like Arc.
Implementations§
source§impl ObjectHandle
impl ObjectHandle
sourcepub fn valid_len(&self) -> usize
pub fn valid_len(&self) -> usize
Get the number of valid bytes after start pointer for object data.
sourcepub fn into_raw(self) -> object_handle
pub fn into_raw(self) -> object_handle
Get the raw object handle.
sourcepub fn from_raw(raw: object_handle) -> Self
pub fn from_raw(raw: object_handle) -> Self
Build an object handle from raw.
sourcepub unsafe fn new(
id: ObjID,
runtime_info: *mut c_void,
start: *mut c_void,
meta: *mut c_void,
map_flags: MapFlags,
valid_len: u32,
) -> Self
pub unsafe fn new( id: ObjID, runtime_info: *mut c_void, start: *mut c_void, meta: *mut c_void, map_flags: MapFlags, valid_len: u32, ) -> Self
Make a new object handle.
§Safety
The caller must ensure that runtime_info is a valid pointer, and points to a repr(C) struct that starts with an AtomicU64 for reference counting.
Trait Implementations§
source§impl Clone for ObjectHandle
impl Clone for ObjectHandle
source§impl Debug for ObjectHandle
impl Debug for ObjectHandle
source§impl Drop for ObjectHandle
impl Drop for ObjectHandle
impl Send for ObjectHandle
impl Sync for ObjectHandle
Auto Trait Implementations§
impl Freeze for ObjectHandle
impl RefUnwindSafe for ObjectHandle
impl Unpin for ObjectHandle
impl UnwindSafe for ObjectHandle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)