twizzler_object

Struct Object

source
pub struct Object<T> { /* private fields */ }
Expand description

A handle for an object with base type T.

Implementations§

source§

impl<T: BaseType + ObjSafe> Object<T>

source

pub fn base(&self) -> Result<&T, BaseError>

Get a reference to the base of an object. Checks to see if the tags and version information for the BaseType match.

source§

impl<BaseType> Object<BaseType>

source

pub unsafe fn base_unchecked(&self) -> &BaseType

Get a reference to the base of an object, bypassing version and tag checks.

§Safety

The caller must ensure that the base of the object really is of type BaseType.

source

pub unsafe fn base_mut_unchecked(&self) -> &mut BaseType

Get a mutable reference to the base of an object, bypassing version and tag checks.

§Safety

The caller must ensure that the base of the object really is of type BaseType.

source§

impl<T> Object<T>

source

pub fn create_with( spec: &CreateSpec, f: impl FnOnce(&mut Object<MaybeUninit<T>>), ) -> Result<Self, CreateError>

Create an object, setting up the initial value for the base in a closure.

source§

impl<T: BaseType> Object<T>

source

pub fn create<A>(spec: &CreateSpec, args: A) -> Result<Self, CreateError>

Create an object, setting up the initial value for base using the BaseType’s init function.

source§

impl<T> Object<T>

source

pub fn init_id( id: ObjID, prot: Protections, _flags: ObjectInitFlags, ) -> Result<Self, ObjectInitError>

Initialize an object handle from an object ID.

source§

impl<T> Object<T>

source

pub unsafe fn meta(&self) -> NonNull<MetaInfo>

Get a mutable reference to the object’s meta info struct.

§Safety

See this crate’s base documentation (Isolation Safety).

source

pub unsafe fn metaext(&self) -> NonNull<MetaExt>

Get a mutable reference to the object’s first meta extension entry.

§Safety

See this crate’s base documentation (Isolation Safety).

source

pub fn meta_nonce(&self) -> Nonce

Get the nonce of the object.

source

pub fn meta_kuid(&self) -> ObjID

Get the public key ID of the object.

source

pub fn meta_flags(&self) -> MetaFlags

Get the meta flags of the object.

source

pub fn meta_tag(&self) -> BaseTag

Get the base tag of the object.

source

pub fn meta_version(&self) -> BaseVersion

Get the base version of the object.

source

pub unsafe fn get_fote_unguarded(&self, idx: usize) -> *mut FotEntry

Get a mutable pointer to one of the object’s FOT entries.

§Safety

See this crate’s base documentation (Isolation Safety). Additionally, the caller must ensure the index does not exceed the number of FOT entries in the object.

source§

impl<T> Object<T>

source

pub fn id(&self) -> ObjID

Get the ID of this object.

source

pub fn slot(&self) -> &Arc<Slot>

Get the slot of this object.

source

pub unsafe fn transmute<N>(self) -> Object<N>

Transmute the object of base type T to base type N.

§Safety

All the safely rules of using core::mem::transmute apply to the base type.

source§

impl<T> Object<T>

source

pub fn raw_lea<P>(&self, off: usize) -> *const P

Get a raw pointer into an object given an offset.

source

pub fn raw_lea_mut<P>(&self, off: usize) -> *mut P

Get a raw mutable pointer into an object given an offset.

Trait Implementations§

source§

impl<T> Clone for Object<T>

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<Base> From<Arc<Slot>> for Object<Base>

source§

fn from(s: Arc<Slot>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Object<T>

§

impl<T> !ObjSafe for Object<T>

§

impl<T> RefUnwindSafe for Object<T>
where T: RefUnwindSafe,

§

impl<T> Send for Object<T>
where T: Send,

§

impl<T> Sync for Object<T>
where T: Sync,

§

impl<T> Unpin for Object<T>
where T: Unpin,

§

impl<T> UnwindSafe for Object<T>
where T: UnwindSafe,

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