[][src]Struct sunrise_libuser::types::Handle

#[repr(transparent)]pub struct Handle(pub NonZeroU32);

A Handle is a sort of reference to a Kernel Object. Its underlying representation is that of a u32. Furthermore, an Option is also guaranteed to be represented on a u32, with None represented as 0. This allows handle to be used directly in the syscall functions.

Handles are closed automatically when Dropped via close_handle.

Implementations

impl Handle[src]

pub fn new(handle: u32) -> Handle[src]

Creates a new handle from the given number. This number should come from a raw syscall. Constructing a handle from an arbitrary number is not unsafe, but may lead to extremely confusing code.

pub fn as_ref(&self) -> HandleRef[src]

Creates a new reference to this handle. See the documentation of HandleRef for more information.

pub fn as_ref_static(&self) -> HandleRef<'static>[src]

Creates a new static reference to this handle. See the documentation of HandleRef for more information.

The kernel guarantees that a Handle is never reused. If the parent Handle dies before this HandleRef is dropped, every function taking this HandleRef will fail with sunrise_libkern::error::KernelError::InvalidHandle

Trait Implementations

impl Debug for Handle[src]

impl Drop for Handle[src]

impl Eq for Handle[src]

impl PartialEq<Handle> for Handle[src]

impl StructuralEq for Handle[src]

impl StructuralPartialEq for Handle[src]

Auto Trait Implementations

impl RefUnwindSafe for Handle

impl Send for Handle

impl Sync for Handle

impl Unpin for Handle

impl UnwindSafe for Handle

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SizedIPCBuffer for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.