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 find_meta_ext(&self, tag: MetaExtTag) -> Option<&MetaExt>
pub fn find_meta_ext(&self, tag: MetaExtTag) -> Option<&MetaExt>
Find the first metadata extension matching the given tag
Sourcepub fn runtime_info(&self) -> *mut u8
pub fn runtime_info(&self) -> *mut u8
Get a pointer to the runtime info.
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) -> ObjectHandle
pub fn from_raw(raw: object_handle) -> ObjectHandle
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: usize,
) -> ObjectHandle
pub unsafe fn new( id: ObjID, runtime_info: *mut c_void, start: *mut c_void, meta: *mut c_void, map_flags: MapFlags, valid_len: usize, ) -> ObjectHandle
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 AsRef<ObjectHandle> for ArenaObject
impl AsRef<ObjectHandle> for ArenaObject
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<T> AsRef<ObjectHandle> for MutObject<T>
impl<T> AsRef<ObjectHandle> for MutObject<T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<T> AsRef<ObjectHandle> for Object<T>
impl<T> AsRef<ObjectHandle> for Object<T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<ObjectHandle> for ObjectHandle
impl AsRef<ObjectHandle> for ObjectHandle
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'a, T> AsRef<ObjectHandle> for Ref<'a, T>
impl<'a, T> AsRef<ObjectHandle> for Ref<'a, T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'a, T> AsRef<ObjectHandle> for RefMut<'a, T>
impl<'a, T> AsRef<ObjectHandle> for RefMut<'a, T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'a, T> AsRef<ObjectHandle> for RefSlice<'a, T>
impl<'a, T> AsRef<ObjectHandle> for RefSlice<'a, T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'a, T> AsRef<ObjectHandle> for RefSliceMut<'a, T>
impl<'a, T> AsRef<ObjectHandle> for RefSliceMut<'a, T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<B> AsRef<ObjectHandle> for TxObject<B>
impl<B> AsRef<ObjectHandle> for TxObject<B>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<T> AsRef<ObjectHandle> for TxRef<T>
impl<T> AsRef<ObjectHandle> for TxRef<T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<T> AsRef<ObjectHandle> for TxRefSlice<T>
impl<T> AsRef<ObjectHandle> for TxRefSlice<T>
Source§fn as_ref(&self) -> &ObjectHandle
fn as_ref(&self) -> &ObjectHandle
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for ObjectHandle
impl Clone for ObjectHandle
Source§fn clone(&self) -> ObjectHandle
fn clone(&self) -> ObjectHandle
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ObjectHandle
impl Debug for ObjectHandle
Source§impl Drop for ObjectHandle
impl Drop for ObjectHandle
Source§impl<'a, T> Into<ObjectHandle> for &Ref<'a, T>
impl<'a, T> Into<ObjectHandle> for &Ref<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for &RefMut<'a, T>
impl<'a, T> Into<ObjectHandle> for &RefMut<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for &RefSlice<'a, T>
impl<'a, T> Into<ObjectHandle> for &RefSlice<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for &RefSliceMut<'a, T>
impl<'a, T> Into<ObjectHandle> for &RefSliceMut<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<B> Into<ObjectHandle> for &TxObject<B>
impl<B> Into<ObjectHandle> for &TxObject<B>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<T> Into<ObjectHandle> for &TxRef<T>
impl<T> Into<ObjectHandle> for &TxRef<T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<T> Into<ObjectHandle> for &TxRefSlice<T>
impl<T> Into<ObjectHandle> for &TxRefSlice<T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for Ref<'a, T>
impl<'a, T> Into<ObjectHandle> for Ref<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for RefMut<'a, T>
impl<'a, T> Into<ObjectHandle> for RefMut<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for RefSlice<'a, T>
impl<'a, T> Into<ObjectHandle> for RefSlice<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<'a, T> Into<ObjectHandle> for RefSliceMut<'a, T>
impl<'a, T> Into<ObjectHandle> for RefSliceMut<'a, T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<B> Into<ObjectHandle> for TxObject<B>
impl<B> Into<ObjectHandle> for TxObject<B>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<T> Into<ObjectHandle> for TxRef<T>
impl<T> Into<ObjectHandle> for TxRef<T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl<T> Into<ObjectHandle> for TxRefSlice<T>
impl<T> Into<ObjectHandle> for TxRefSlice<T>
Source§fn into(self) -> ObjectHandle
fn into(self) -> ObjectHandle
Converts this type into the (usually inferred) input type.
Source§impl RawObject for ObjectHandle
impl RawObject for ObjectHandle
Source§fn handle(&self) -> &ObjectHandle
fn handle(&self) -> &ObjectHandle
Get the underlying runtime handle for this object.
Source§fn base_mut_ptr<T>(&self) -> *mut T
fn base_mut_ptr<T>(&self) -> *mut T
Get a mut pointer to the object base.
Source§fn meta_mut_ptr(&self) -> *mut MetaInfo
fn meta_mut_ptr(&self) -> *mut MetaInfo
Get a mut pointer to the object metadata.
Source§fn fote_ptr(&self, idx: usize) -> Option<*const FotEntry>
fn fote_ptr(&self, idx: usize) -> Option<*const FotEntry>
Get a const pointer to a given FOT entry.
Source§fn fote_ptr_mut(&self, idx: usize) -> Option<*mut FotEntry>
fn fote_ptr_mut(&self, idx: usize) -> Option<*mut FotEntry>
Get a mut pointer to a given FOT entry.
Source§fn lea(&self, offset: usize, _len: usize) -> Option<*const u8>
fn lea(&self, offset: usize, _len: usize) -> Option<*const u8>
Get a const pointer to given range of the object.
impl Send for ObjectHandle
impl Sync for ObjectHandle
Auto Trait Implementations§
impl Freeze for ObjectHandle
impl !ObjSafe for ObjectHandle
impl RefUnwindSafe for ObjectHandle
impl StoreCopy 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