Struct optee_utee::object::ObjectHandle

source ·
pub struct ObjectHandle(/* private fields */);
Expand description

An opaque handle on an object.

Implementations§

source§

impl ObjectHandle

source

pub fn from_raw(raw: TEE_ObjectHandle) -> Result<ObjectHandle>

source

pub fn handle(&self) -> TEE_ObjectHandle

source

pub fn forget(self)

Forget the inner handle to prevent a double-free, this function would be called when the inner handle is(or will be) freed externally.

Example:

// `external_handle` is a handle that is constructed and controlled
// externally.
// `handle` is valid, and will call TEE_CloseObject on
// `external_handle` when it is dropping, which is not allowed
// as the `external_handle` is externally controlled.
let mut handle = ObjectHandle::from_raw(external_handle)?;
// ... Some operation
// forget the inner handle, so it won't call TEE_CloseObject on
// `external_handle`
handle.forget();

Trait Implementations§

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 GenericObject for ObjectHandle

source§

fn handle(&self) -> TEE_ObjectHandle

Return the handle of an object.
source§

fn info(&self) -> Result<ObjectInfo>

Return the characteristics of an object. Read more
source§

fn restrict_usage(&mut self, obj_usage: UsageFlag) -> Result<()>

Restrict the object usage flags of an object handle to contain at most the flags passed in the obj_usage parameter. Read more
source§

fn ref_attribute(&self, id: AttributeId, buffer: &mut [u8]) -> Result<usize>

Extract one buffer attribute from an object. The attribute is identified by the argument id. Read more
source§

fn value_attribute(&self, id: u32) -> Result<(u32, u32)>

Extract one value attribute from an object. The attribute is identified by the argument id. Read more

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

§

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

§

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.