Struct ObjectHandle

Source
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

Source

pub fn start(&self) -> *mut u8

Get a pointer to the start of object data.

Source

pub fn meta(&self) -> *mut MetaInfo

Get a pointer to the metadata structure.

Source

pub fn meta_exts(&self) -> &[MetaExt]

Get a slice of metadata extensions

Source

pub fn find_meta_ext(&self, tag: MetaExtTag) -> Option<&MetaExt>

Find the first metadata extension matching the given tag

Source

pub fn runtime_info(&self) -> *mut u8

Get a pointer to the runtime info.

Source

pub fn map_flags(&self) -> MapFlags

Get map flags.

Source

pub fn valid_len(&self) -> usize

Get the number of valid bytes after start pointer for object data.

Source

pub fn id(&self) -> ObjID

Get the object ID.

Source

pub fn into_raw(self) -> object_handle

Get the raw object handle.

Source

pub fn from_raw(raw: object_handle) -> ObjectHandle

Build an object handle from raw.

Source

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

Source§

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>

Source§

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>

Source§

fn as_ref(&self) -> &ObjectHandle

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ObjectHandle> for ObjectHandle

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

fn as_ref(&self) -> &ObjectHandle

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ObjectHandle

Source§

fn clone(&self) -> ObjectHandle

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObjectHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for ObjectHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, T> Into<ObjectHandle> for &Ref<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for &RefMut<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for &RefSlice<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for &RefSliceMut<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<B> Into<ObjectHandle> for &TxObject<B>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<T> Into<ObjectHandle> for &TxRef<T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<T> Into<ObjectHandle> for &TxRefSlice<T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for Ref<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for RefMut<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for RefSlice<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Into<ObjectHandle> for RefSliceMut<'a, T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<B> Into<ObjectHandle> for TxObject<B>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<T> Into<ObjectHandle> for TxRef<T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl<T> Into<ObjectHandle> for TxRefSlice<T>

Source§

fn into(self) -> ObjectHandle

Converts this type into the (usually inferred) input type.
Source§

impl RawObject for ObjectHandle

Source§

fn handle(&self) -> &ObjectHandle

Get the underlying runtime handle for this object.
Source§

fn id(&self) -> ObjID

Get the object ID.
Source§

fn base_ptr<T>(&self) -> *const T

Get a const pointer to the object base.
Source§

fn base_mut_ptr<T>(&self) -> *mut T

Get a mut pointer to the object base.
Source§

fn meta_ptr(&self) -> *const MetaInfo

Get a const pointer to the object metadata.
Source§

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>

Get a const pointer to a given FOT entry.
Source§

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>

Get a const pointer to given range of the object.
Source§

fn lea_mut(&self, offset: usize, _len: usize) -> Option<*mut u8>

Get a mut pointer to given range of the object.
Source§

fn ptr_local(&self, ptr: *const u8) -> Option<usize>

If the pointer is local to this object, return the offset into the object. Otherwise, return None.
Source§

impl Send for ObjectHandle

Source§

impl Sync for ObjectHandle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more