pub struct NullableHandle(/* private fields */);Expand description
An object representing a Zircon handle.
Internally, it is represented as a 32-bit integer, but this wrapper enforces
strict ownership semantics. The Drop implementation closes the handle.
This type represents the most general reference to a kernel object, and can be interconverted to and from more specific types. Those conversions are not enforced in the type system; attempting to use them will result in errors returned by the kernel. These conversions don’t change the underlying representation, but do change the type and thus what operations are available.
Implementations§
Source§impl NullableHandle
impl NullableHandle
Sourcepub const fn invalid() -> Self
pub const fn invalid() -> Self
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
Sourcepub const unsafe fn from_raw(raw: zx_handle_t) -> Self
pub const unsafe fn from_raw(raw: zx_handle_t) -> Self
If a raw handle is obtained from some other source, this method converts it into a type-safe owned handle.
§Safety
raw must either be a valid handle (i.e. not dangling), or
ZX_HANDLE_INVALID. If raw is a valid handle, then either:
rawmay be closed manually and the returnedNullableHandlemust not be dropped.- Or
rawmust not be closed until the returnedNullableHandleis dropped, at which time it will closeraw.
pub const fn raw_handle(&self) -> zx_handle_t
pub fn into_raw(self) -> zx_handle_t
pub fn as_handle_ref(&self) -> HandleRef<'_>
pub const fn is_invalid(&self) -> bool
pub fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
pub fn replace_handle(self, rights: Rights) -> Result<Self, Status>
pub fn signal( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
pub fn wait_one( &self, signals: Signals, deadline: MonotonicInstant, ) -> WaitResult
pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
pub fn wait_item(&self, signals: Signals) -> WaitItem<'_>
pub fn get_name(&self) -> Result<Name, Status>
pub fn set_name(&self, name: &Name) -> Result<(), Status>
pub fn basic_info(&self) -> Result<HandleBasicInfo, Status>
pub fn count_info(&self) -> Result<HandleCountInfo, Status>
pub fn koid(&self) -> Result<Koid, Status>
Trait Implementations§
Source§impl AsHandleRef for NullableHandle
impl AsHandleRef for NullableHandle
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
object_wait_many.Source§impl<Reference: Timeline, Output: Timeline> AsRef<NullableHandle> for Clock<Reference, Output>
impl<Reference: Timeline, Output: Timeline> AsRef<NullableHandle> for Clock<Reference, Output>
Source§fn as_ref(&self) -> &NullableHandle
fn as_ref(&self) -> &NullableHandle
Source§impl<R, W> AsRef<NullableHandle> for Fifo<R, W>
impl<R, W> AsRef<NullableHandle> for Fifo<R, W>
Source§fn as_ref(&self) -> &NullableHandle
fn as_ref(&self) -> &NullableHandle
Source§impl<K: InterruptKind, T: Timeline> AsRef<NullableHandle> for Interrupt<K, T>
impl<K: InterruptKind, T: Timeline> AsRef<NullableHandle> for Interrupt<K, T>
Source§fn as_ref(&self) -> &NullableHandle
fn as_ref(&self) -> &NullableHandle
Source§impl<T: Timeline> AsRef<NullableHandle> for Timer<T>
impl<T: Timeline> AsRef<NullableHandle> for Timer<T>
Source§fn as_ref(&self) -> &NullableHandle
fn as_ref(&self) -> &NullableHandle
Source§impl Debug for NullableHandle
impl Debug for NullableHandle
Source§impl From<Bti> for NullableHandle
impl From<Bti> for NullableHandle
Source§fn from(x: Bti) -> NullableHandle
fn from(x: Bti) -> NullableHandle
Source§impl From<Channel> for NullableHandle
impl From<Channel> for NullableHandle
Source§fn from(x: Channel) -> NullableHandle
fn from(x: Channel) -> NullableHandle
Source§impl<Reference: Timeline, Output: Timeline> From<Clock<Reference, Output>> for NullableHandle
impl<Reference: Timeline, Output: Timeline> From<Clock<Reference, Output>> for NullableHandle
Source§fn from(x: Clock<Reference, Output>) -> NullableHandle
fn from(x: Clock<Reference, Output>) -> NullableHandle
Source§impl From<Counter> for NullableHandle
impl From<Counter> for NullableHandle
Source§fn from(x: Counter) -> NullableHandle
fn from(x: Counter) -> NullableHandle
Source§impl From<DebugLog> for NullableHandle
impl From<DebugLog> for NullableHandle
Source§fn from(x: DebugLog) -> NullableHandle
fn from(x: DebugLog) -> NullableHandle
Source§impl From<Event> for NullableHandle
impl From<Event> for NullableHandle
Source§fn from(x: Event) -> NullableHandle
fn from(x: Event) -> NullableHandle
Source§impl From<EventPair> for NullableHandle
impl From<EventPair> for NullableHandle
Source§fn from(x: EventPair) -> NullableHandle
fn from(x: EventPair) -> NullableHandle
Source§impl From<Exception> for NullableHandle
impl From<Exception> for NullableHandle
Source§fn from(x: Exception) -> NullableHandle
fn from(x: Exception) -> NullableHandle
Source§impl<R, W> From<Fifo<R, W>> for NullableHandle
impl<R, W> From<Fifo<R, W>> for NullableHandle
Source§fn from(x: Fifo<R, W>) -> NullableHandle
fn from(x: Fifo<R, W>) -> NullableHandle
Source§impl From<Guest> for NullableHandle
impl From<Guest> for NullableHandle
Source§fn from(x: Guest) -> NullableHandle
fn from(x: Guest) -> NullableHandle
Source§impl From<Handle> for NullableHandle
impl From<Handle> for NullableHandle
Source§impl<K: InterruptKind, T: Timeline> From<Interrupt<K, T>> for NullableHandle
impl<K: InterruptKind, T: Timeline> From<Interrupt<K, T>> for NullableHandle
Source§fn from(x: Interrupt<K, T>) -> NullableHandle
fn from(x: Interrupt<K, T>) -> NullableHandle
Source§impl From<Iob> for NullableHandle
impl From<Iob> for NullableHandle
Source§fn from(x: Iob) -> NullableHandle
fn from(x: Iob) -> NullableHandle
Source§fn from(x: IobSharedRegion) -> NullableHandle
fn from(x: IobSharedRegion) -> NullableHandle
Source§impl From<Iommu> for NullableHandle
impl From<Iommu> for NullableHandle
Source§fn from(x: Iommu) -> NullableHandle
fn from(x: Iommu) -> NullableHandle
Source§impl From<Job> for NullableHandle
impl From<Job> for NullableHandle
Source§fn from(x: Job) -> NullableHandle
fn from(x: Job) -> NullableHandle
Source§impl From<Msi> for NullableHandle
impl From<Msi> for NullableHandle
Source§fn from(x: Msi) -> NullableHandle
fn from(x: Msi) -> NullableHandle
Source§impl From<NullableHandle> for Bti
impl From<NullableHandle> for Bti
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Channel
impl From<NullableHandle> for Channel
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl<Reference: Timeline, Output: Timeline> From<NullableHandle> for Clock<Reference, Output>
impl<Reference: Timeline, Output: Timeline> From<NullableHandle> for Clock<Reference, Output>
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Counter
impl From<NullableHandle> for Counter
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for DebugLog
impl From<NullableHandle> for DebugLog
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Event
impl From<NullableHandle> for Event
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for EventPair
impl From<NullableHandle> for EventPair
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Exception
impl From<NullableHandle> for Exception
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl<R, W> From<NullableHandle> for Fifo<R, W>
impl<R, W> From<NullableHandle> for Fifo<R, W>
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Guest
impl From<NullableHandle> for Guest
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl<K: InterruptKind, T: Timeline> From<NullableHandle> for Interrupt<K, T>
impl<K: InterruptKind, T: Timeline> From<NullableHandle> for Interrupt<K, T>
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Iob
impl From<NullableHandle> for Iob
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Iommu
impl From<NullableHandle> for Iommu
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Job
impl From<NullableHandle> for Job
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Msi
impl From<NullableHandle> for Msi
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Pager
impl From<NullableHandle> for Pager
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for PciDevice
impl From<NullableHandle> for PciDevice
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Pmt
impl From<NullableHandle> for Pmt
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Port
impl From<NullableHandle> for Port
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Process
impl From<NullableHandle> for Process
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Profile
impl From<NullableHandle> for Profile
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Resource
impl From<NullableHandle> for Resource
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Socket
impl From<NullableHandle> for Socket
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Stream
impl From<NullableHandle> for Stream
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for SuspendToken
impl From<NullableHandle> for SuspendToken
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Thread
impl From<NullableHandle> for Thread
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl<T: Timeline> From<NullableHandle> for Timer<T>
impl<T: Timeline> From<NullableHandle> for Timer<T>
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Vcpu
impl From<NullableHandle> for Vcpu
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Vmar
impl From<NullableHandle> for Vmar
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<NullableHandle> for Vmo
impl From<NullableHandle> for Vmo
Source§fn from(handle: NullableHandle) -> Self
fn from(handle: NullableHandle) -> Self
Source§impl From<Pager> for NullableHandle
impl From<Pager> for NullableHandle
Source§fn from(x: Pager) -> NullableHandle
fn from(x: Pager) -> NullableHandle
Source§impl From<PciDevice> for NullableHandle
impl From<PciDevice> for NullableHandle
Source§fn from(x: PciDevice) -> NullableHandle
fn from(x: PciDevice) -> NullableHandle
Source§impl From<Pmt> for NullableHandle
impl From<Pmt> for NullableHandle
Source§fn from(x: Pmt) -> NullableHandle
fn from(x: Pmt) -> NullableHandle
Source§impl From<Port> for NullableHandle
impl From<Port> for NullableHandle
Source§fn from(x: Port) -> NullableHandle
fn from(x: Port) -> NullableHandle
Source§impl From<Process> for NullableHandle
impl From<Process> for NullableHandle
Source§fn from(x: Process) -> NullableHandle
fn from(x: Process) -> NullableHandle
Source§impl From<Profile> for NullableHandle
impl From<Profile> for NullableHandle
Source§fn from(x: Profile) -> NullableHandle
fn from(x: Profile) -> NullableHandle
Source§impl From<Resource> for NullableHandle
impl From<Resource> for NullableHandle
Source§fn from(x: Resource) -> NullableHandle
fn from(x: Resource) -> NullableHandle
Source§impl From<Socket> for NullableHandle
impl From<Socket> for NullableHandle
Source§fn from(x: Socket) -> NullableHandle
fn from(x: Socket) -> NullableHandle
Source§impl From<Stream> for NullableHandle
impl From<Stream> for NullableHandle
Source§fn from(x: Stream) -> NullableHandle
fn from(x: Stream) -> NullableHandle
Source§impl From<SuspendToken> for NullableHandle
impl From<SuspendToken> for NullableHandle
Source§fn from(x: SuspendToken) -> NullableHandle
fn from(x: SuspendToken) -> NullableHandle
Source§impl From<Thread> for NullableHandle
impl From<Thread> for NullableHandle
Source§fn from(x: Thread) -> NullableHandle
fn from(x: Thread) -> NullableHandle
Source§impl<T: Timeline> From<Timer<T>> for NullableHandle
impl<T: Timeline> From<Timer<T>> for NullableHandle
Source§fn from(x: Timer<T>) -> NullableHandle
fn from(x: Timer<T>) -> NullableHandle
Source§impl From<Vcpu> for NullableHandle
impl From<Vcpu> for NullableHandle
Source§fn from(x: Vcpu) -> NullableHandle
fn from(x: Vcpu) -> NullableHandle
Source§impl From<Vmar> for NullableHandle
impl From<Vmar> for NullableHandle
Source§fn from(x: Vmar) -> NullableHandle
fn from(x: Vmar) -> NullableHandle
Source§impl From<Vmo> for NullableHandle
impl From<Vmo> for NullableHandle
Source§fn from(x: Vmo) -> NullableHandle
fn from(x: Vmo) -> NullableHandle
Source§impl Hash for NullableHandle
impl Hash for NullableHandle
Source§impl Ord for NullableHandle
impl Ord for NullableHandle
Source§fn cmp(&self, other: &NullableHandle) -> Ordering
fn cmp(&self, other: &NullableHandle) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for NullableHandle
impl PartialEq for NullableHandle
Source§fn eq(&self, other: &NullableHandle) -> bool
fn eq(&self, other: &NullableHandle) -> bool
self and other values to be equal, and is used by ==.