Struct optee_utee::object::ObjectHandle
source · pub struct ObjectHandle(/* private fields */);
Expand description
An opaque handle on an object.
Implementations§
source§impl ObjectHandle
impl ObjectHandle
pub fn from_raw(raw: TEE_ObjectHandle) -> Result<ObjectHandle>
pub fn handle(&self) -> TEE_ObjectHandle
sourcepub fn forget(self)
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
impl Debug for ObjectHandle
source§impl Drop for ObjectHandle
impl Drop for ObjectHandle
source§impl GenericObject for ObjectHandle
impl GenericObject for ObjectHandle
source§fn handle(&self) -> TEE_ObjectHandle
fn handle(&self) -> TEE_ObjectHandle
Return the handle of an object.
source§fn restrict_usage(&mut self, obj_usage: UsageFlag) -> Result<()>
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>
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
Auto Trait Implementations§
impl Freeze for ObjectHandle
impl RefUnwindSafe for ObjectHandle
impl !Send for ObjectHandle
impl !Sync 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