twizzler_rt_abi::object

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 u8

Get a pointer to the metadata structure.

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) -> Self

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: 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

source§

fn clone(&self) -> Self

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

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 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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.