Struct NullableHandle
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§
§impl NullableHandle
impl NullableHandle
pub const fn invalid() -> NullableHandle
pub const fn invalid() -> NullableHandle
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
pub const unsafe fn from_raw(raw: u32) -> NullableHandle
pub const unsafe fn from_raw(raw: u32) -> NullableHandle
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 fn is_invalid(&self) -> bool
pub fn replace(self, rights: Rights) -> Result<NullableHandle, Status>
Trait Implementations§
§impl AsHandleRef for NullableHandle
impl AsHandleRef for NullableHandle
§fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>
fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>
object_wait_many.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> WaitResult
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
Source§impl CompatFrom<NullableHandle> for NullableHandle
Available on crate feature fuchsia only.
impl CompatFrom<NullableHandle> for NullableHandle
fuchsia only.Source§fn compat_from(value: NullableHandle) -> NullableHandle
fn compat_from(value: NullableHandle) -> NullableHandle
value into a value of this type.§impl Debug for NullableHandle
impl Debug for NullableHandle
Source§impl<E> Encode<WireHandle, E> for NullableHandlewhere
E: HandleEncoder + ?Sized,
impl<E> Encode<WireHandle, E> for NullableHandlewhere
E: HandleEncoder + ?Sized,
Source§fn encode(
self,
encoder: &mut E,
out: &mut MaybeUninit<WireHandle>,
_constraint: (),
) -> Result<(), EncodeError>
fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireHandle>, _constraint: (), ) -> Result<(), EncodeError>
Source§const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
Source§impl<E> EncodeOption<WireOptionalHandle, E> for NullableHandlewhere
E: HandleEncoder + ?Sized,
impl<E> EncodeOption<WireOptionalHandle, E> for NullableHandlewhere
E: HandleEncoder + ?Sized,
Source§fn encode_option(
this: Option<NullableHandle>,
encoder: &mut E,
out: &mut MaybeUninit<WireOptionalHandle>,
_constraint: (),
) -> Result<(), EncodeError>
fn encode_option( this: Option<NullableHandle>, encoder: &mut E, out: &mut MaybeUninit<WireOptionalHandle>, _constraint: (), ) -> Result<(), EncodeError>
§impl From<Bti> for NullableHandle
impl From<Bti> for NullableHandle
§fn from(x: Bti) -> NullableHandle
fn from(x: Bti) -> NullableHandle
§impl From<Bti> for NullableHandle
impl From<Bti> for NullableHandle
§fn from(x: Bti) -> NullableHandle
fn from(x: Bti) -> NullableHandle
§impl From<Channel> for NullableHandle
impl From<Channel> for NullableHandle
§fn from(x: Channel) -> NullableHandle
fn from(x: Channel) -> NullableHandle
§impl<T> From<ClientEnd<T>> for NullableHandle
impl<T> From<ClientEnd<T>> for NullableHandle
§fn from(client: ClientEnd<T>) -> NullableHandle
fn from(client: ClientEnd<T>) -> NullableHandle
§impl<Reference, Output> From<Clock<Reference, Output>> for NullableHandle
impl<Reference, Output> From<Clock<Reference, Output>> for NullableHandle
§fn from(x: Clock<Reference, Output>) -> NullableHandle
fn from(x: Clock<Reference, Output>) -> NullableHandle
§impl From<Counter> for NullableHandle
impl From<Counter> for NullableHandle
§fn from(x: Counter) -> NullableHandle
fn from(x: Counter) -> NullableHandle
§impl From<DebugLog> for NullableHandle
impl From<DebugLog> for NullableHandle
§fn from(x: DebugLog) -> NullableHandle
fn from(x: DebugLog) -> NullableHandle
§impl From<Event> for NullableHandle
impl From<Event> for NullableHandle
§fn from(x: Event) -> NullableHandle
fn from(x: Event) -> NullableHandle
§impl From<EventPair> for NullableHandle
impl From<EventPair> for NullableHandle
§fn from(x: EventPair) -> NullableHandle
fn from(x: EventPair) -> NullableHandle
§impl From<Exception> for NullableHandle
impl From<Exception> for NullableHandle
§fn from(x: Exception) -> NullableHandle
fn from(x: Exception) -> NullableHandle
§impl From<Exception> for NullableHandle
impl From<Exception> for NullableHandle
§fn from(x: Exception) -> NullableHandle
fn from(x: Exception) -> NullableHandle
§impl<R, W> From<Fifo<R, W>> for NullableHandle
impl<R, W> From<Fifo<R, W>> for NullableHandle
§fn from(x: Fifo<R, W>) -> NullableHandle
fn from(x: Fifo<R, W>) -> NullableHandle
§impl From<Guest> for NullableHandle
impl From<Guest> for NullableHandle
§fn from(x: Guest) -> NullableHandle
fn from(x: Guest) -> NullableHandle
§impl<K, T> From<Interrupt<K, T>> for NullableHandlewhere
K: InterruptKind,
T: Timeline,
impl<K, T> From<Interrupt<K, T>> for NullableHandlewhere
K: InterruptKind,
T: Timeline,
§fn from(x: Interrupt<K, T>) -> NullableHandle
fn from(x: Interrupt<K, T>) -> NullableHandle
§impl From<Iob> for NullableHandle
impl From<Iob> for NullableHandle
§fn from(x: Iob) -> NullableHandle
fn from(x: Iob) -> NullableHandle
§fn from(x: IobSharedRegion) -> NullableHandle
fn from(x: IobSharedRegion) -> NullableHandle
§impl From<Iommu> for NullableHandle
impl From<Iommu> for NullableHandle
§fn from(x: Iommu) -> NullableHandle
fn from(x: Iommu) -> NullableHandle
§impl From<Iommu> for NullableHandle
impl From<Iommu> for NullableHandle
§fn from(x: Iommu) -> NullableHandle
fn from(x: Iommu) -> NullableHandle
§impl From<Job> for NullableHandle
impl From<Job> for NullableHandle
§fn from(x: Job) -> NullableHandle
fn from(x: Job) -> NullableHandle
§impl From<Msi> for NullableHandle
impl From<Msi> for NullableHandle
§fn from(x: Msi) -> NullableHandle
fn from(x: Msi) -> NullableHandle
§impl From<NullableHandle> for Bti
impl From<NullableHandle> for Bti
§fn from(handle: NullableHandle) -> Bti
fn from(handle: NullableHandle) -> Bti
§impl From<NullableHandle> for Bti
impl From<NullableHandle> for Bti
§fn from(handle: NullableHandle) -> Bti
fn from(handle: NullableHandle) -> Bti
§impl From<NullableHandle> for Channel
impl From<NullableHandle> for Channel
§fn from(handle: NullableHandle) -> Channel
fn from(handle: NullableHandle) -> Channel
§impl<T> From<NullableHandle> for ClientEnd<T>
impl<T> From<NullableHandle> for ClientEnd<T>
§fn from(handle: NullableHandle) -> ClientEnd<T>
fn from(handle: NullableHandle) -> ClientEnd<T>
§impl<Reference, Output> From<NullableHandle> for Clock<Reference, Output>
impl<Reference, Output> From<NullableHandle> for Clock<Reference, Output>
§fn from(handle: NullableHandle) -> Clock<Reference, Output>
fn from(handle: NullableHandle) -> Clock<Reference, Output>
§impl From<NullableHandle> for Counter
impl From<NullableHandle> for Counter
§fn from(handle: NullableHandle) -> Counter
fn from(handle: NullableHandle) -> Counter
§impl From<NullableHandle> for DebugLog
impl From<NullableHandle> for DebugLog
§fn from(handle: NullableHandle) -> DebugLog
fn from(handle: NullableHandle) -> DebugLog
§impl From<NullableHandle> for Event
impl From<NullableHandle> for Event
§fn from(handle: NullableHandle) -> Event
fn from(handle: NullableHandle) -> Event
§impl From<NullableHandle> for EventPair
impl From<NullableHandle> for EventPair
§fn from(handle: NullableHandle) -> EventPair
fn from(handle: NullableHandle) -> EventPair
§impl From<NullableHandle> for Exception
impl From<NullableHandle> for Exception
§fn from(handle: NullableHandle) -> Exception
fn from(handle: NullableHandle) -> Exception
§impl From<NullableHandle> for Exception
impl From<NullableHandle> for Exception
§fn from(handle: NullableHandle) -> Exception
fn from(handle: NullableHandle) -> Exception
§impl<R, W> From<NullableHandle> for Fifo<R, W>
impl<R, W> From<NullableHandle> for Fifo<R, W>
§fn from(handle: NullableHandle) -> Fifo<R, W>
fn from(handle: NullableHandle) -> Fifo<R, W>
§impl From<NullableHandle> for Guest
impl From<NullableHandle> for Guest
§fn from(handle: NullableHandle) -> Guest
fn from(handle: NullableHandle) -> Guest
§impl<K, T> From<NullableHandle> for Interrupt<K, T>where
K: InterruptKind,
T: Timeline,
impl<K, T> From<NullableHandle> for Interrupt<K, T>where
K: InterruptKind,
T: Timeline,
§fn from(handle: NullableHandle) -> Interrupt<K, T>
fn from(handle: NullableHandle) -> Interrupt<K, T>
§impl From<NullableHandle> for Iob
impl From<NullableHandle> for Iob
§fn from(handle: NullableHandle) -> Iob
fn from(handle: NullableHandle) -> Iob
§fn from(handle: NullableHandle) -> IobSharedRegion
fn from(handle: NullableHandle) -> IobSharedRegion
§impl From<NullableHandle> for Iommu
impl From<NullableHandle> for Iommu
§fn from(handle: NullableHandle) -> Iommu
fn from(handle: NullableHandle) -> Iommu
§impl From<NullableHandle> for Iommu
impl From<NullableHandle> for Iommu
§fn from(handle: NullableHandle) -> Iommu
fn from(handle: NullableHandle) -> Iommu
§impl From<NullableHandle> for Job
impl From<NullableHandle> for Job
§fn from(handle: NullableHandle) -> Job
fn from(handle: NullableHandle) -> Job
§impl From<NullableHandle> for Msi
impl From<NullableHandle> for Msi
§fn from(handle: NullableHandle) -> Msi
fn from(handle: NullableHandle) -> Msi
§impl From<NullableHandle> for Pager
impl From<NullableHandle> for Pager
§fn from(handle: NullableHandle) -> Pager
fn from(handle: NullableHandle) -> Pager
§impl From<NullableHandle> for Pager
impl From<NullableHandle> for Pager
§fn from(handle: NullableHandle) -> Pager
fn from(handle: NullableHandle) -> Pager
§impl From<NullableHandle> for PciDevice
impl From<NullableHandle> for PciDevice
§fn from(handle: NullableHandle) -> PciDevice
fn from(handle: NullableHandle) -> PciDevice
§impl From<NullableHandle> for Pmt
impl From<NullableHandle> for Pmt
§fn from(handle: NullableHandle) -> Pmt
fn from(handle: NullableHandle) -> Pmt
§impl From<NullableHandle> for Pmt
impl From<NullableHandle> for Pmt
§fn from(handle: NullableHandle) -> Pmt
fn from(handle: NullableHandle) -> Pmt
§impl From<NullableHandle> for Port
impl From<NullableHandle> for Port
§fn from(handle: NullableHandle) -> Port
fn from(handle: NullableHandle) -> Port
§impl From<NullableHandle> for Process
impl From<NullableHandle> for Process
§fn from(handle: NullableHandle) -> Process
fn from(handle: NullableHandle) -> Process
§impl From<NullableHandle> for Profile
impl From<NullableHandle> for Profile
§fn from(handle: NullableHandle) -> Profile
fn from(handle: NullableHandle) -> Profile
§impl From<NullableHandle> for Resource
impl From<NullableHandle> for Resource
§fn from(handle: NullableHandle) -> Resource
fn from(handle: NullableHandle) -> Resource
§impl<T> From<NullableHandle> for ServerEnd<T>
impl<T> From<NullableHandle> for ServerEnd<T>
§fn from(handle: NullableHandle) -> ServerEnd<T>
fn from(handle: NullableHandle) -> ServerEnd<T>
§impl From<NullableHandle> for Socket
impl From<NullableHandle> for Socket
§fn from(handle: NullableHandle) -> Socket
fn from(handle: NullableHandle) -> Socket
§impl From<NullableHandle> for Stream
impl From<NullableHandle> for Stream
§fn from(handle: NullableHandle) -> Stream ⓘ
fn from(handle: NullableHandle) -> Stream ⓘ
§impl From<NullableHandle> for SuspendToken
impl From<NullableHandle> for SuspendToken
§fn from(handle: NullableHandle) -> SuspendToken
fn from(handle: NullableHandle) -> SuspendToken
§impl From<NullableHandle> for Thread
impl From<NullableHandle> for Thread
§fn from(handle: NullableHandle) -> Thread
fn from(handle: NullableHandle) -> Thread
§impl<T> From<NullableHandle> for Timer<T>where
T: Timeline,
impl<T> From<NullableHandle> for Timer<T>where
T: Timeline,
§fn from(handle: NullableHandle) -> Timer<T>
fn from(handle: NullableHandle) -> Timer<T>
§impl From<NullableHandle> for Vcpu
impl From<NullableHandle> for Vcpu
§fn from(handle: NullableHandle) -> Vcpu
fn from(handle: NullableHandle) -> Vcpu
§impl From<NullableHandle> for Vmar
impl From<NullableHandle> for Vmar
§fn from(handle: NullableHandle) -> Vmar
fn from(handle: NullableHandle) -> Vmar
§impl From<NullableHandle> for Vmo
impl From<NullableHandle> for Vmo
§fn from(handle: NullableHandle) -> Vmo
fn from(handle: NullableHandle) -> Vmo
§impl From<Pager> for NullableHandle
impl From<Pager> for NullableHandle
§fn from(x: Pager) -> NullableHandle
fn from(x: Pager) -> NullableHandle
§impl From<Pager> for NullableHandle
impl From<Pager> for NullableHandle
§fn from(x: Pager) -> NullableHandle
fn from(x: Pager) -> NullableHandle
§impl From<PciDevice> for NullableHandle
impl From<PciDevice> for NullableHandle
§fn from(x: PciDevice) -> NullableHandle
fn from(x: PciDevice) -> NullableHandle
§impl From<Pmt> for NullableHandle
impl From<Pmt> for NullableHandle
§fn from(x: Pmt) -> NullableHandle
fn from(x: Pmt) -> NullableHandle
§impl From<Pmt> for NullableHandle
impl From<Pmt> for NullableHandle
§fn from(x: Pmt) -> NullableHandle
fn from(x: Pmt) -> NullableHandle
§impl From<Port> for NullableHandle
impl From<Port> for NullableHandle
§fn from(x: Port) -> NullableHandle
fn from(x: Port) -> NullableHandle
§impl From<Process> for NullableHandle
impl From<Process> for NullableHandle
§fn from(x: Process) -> NullableHandle
fn from(x: Process) -> NullableHandle
§impl From<Profile> for NullableHandle
impl From<Profile> for NullableHandle
§fn from(x: Profile) -> NullableHandle
fn from(x: Profile) -> NullableHandle
§impl From<Resource> for NullableHandle
impl From<Resource> for NullableHandle
§fn from(x: Resource) -> NullableHandle
fn from(x: Resource) -> NullableHandle
§impl<T> From<ServerEnd<T>> for NullableHandle
impl<T> From<ServerEnd<T>> for NullableHandle
§fn from(server: ServerEnd<T>) -> NullableHandle
fn from(server: ServerEnd<T>) -> NullableHandle
§impl From<Socket> for NullableHandle
impl From<Socket> for NullableHandle
§fn from(x: Socket) -> NullableHandle
fn from(x: Socket) -> NullableHandle
§impl From<Stream> for NullableHandle
impl From<Stream> for NullableHandle
§fn from(x: Stream) -> NullableHandle
fn from(x: Stream) -> NullableHandle
§impl From<SuspendToken> for NullableHandle
impl From<SuspendToken> for NullableHandle
§fn from(x: SuspendToken) -> NullableHandle
fn from(x: SuspendToken) -> NullableHandle
§impl From<Thread> for NullableHandle
impl From<Thread> for NullableHandle
§fn from(x: Thread) -> NullableHandle
fn from(x: Thread) -> NullableHandle
§impl<T> From<Timer<T>> for NullableHandlewhere
T: Timeline,
impl<T> From<Timer<T>> for NullableHandlewhere
T: Timeline,
§fn from(x: Timer<T>) -> NullableHandle
fn from(x: Timer<T>) -> NullableHandle
§impl From<Vcpu> for NullableHandle
impl From<Vcpu> for NullableHandle
§fn from(x: Vcpu) -> NullableHandle
fn from(x: Vcpu) -> NullableHandle
§impl From<Vmar> for NullableHandle
impl From<Vmar> for NullableHandle
§fn from(x: Vmar) -> NullableHandle
fn from(x: Vmar) -> NullableHandle
§impl From<Vmo> for NullableHandle
impl From<Vmo> for NullableHandle
§fn from(x: Vmo) -> NullableHandle
fn from(x: Vmo) -> NullableHandle
Source§impl FromWire<WireHandle> for NullableHandle
impl FromWire<WireHandle> for NullableHandle
Source§fn from_wire(wire: WireHandle) -> NullableHandle
fn from_wire(wire: WireHandle) -> NullableHandle
wire to this type.Source§const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
Source§impl FromWireOption<WireOptionalHandle> for NullableHandle
impl FromWireOption<WireOptionalHandle> for NullableHandle
Source§fn from_wire_option(wire: WireOptionalHandle) -> Option<NullableHandle>
fn from_wire_option(wire: WireOptionalHandle) -> Option<NullableHandle>
wire to an option of this type.§impl HandleBased for NullableHandle
impl HandleBased for NullableHandle
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
§fn into_handle(self) -> NullableHandle
fn into_handle(self) -> NullableHandle
§fn from_handle(handle: NullableHandle) -> Self
fn from_handle(handle: NullableHandle) -> Self
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn is_invalid_handle(&self) -> bool
§impl HandleFor<DefaultFuchsiaResourceDialect> for NullableHandle
impl HandleFor<DefaultFuchsiaResourceDialect> for NullableHandle
§type HandleInfo = HandleInfo
type HandleInfo = HandleInfo
§fn invalid() -> NullableHandle
fn invalid() -> NullableHandle
Handle used as a place filler when
we remove handles from an array.§fn is_invalid(&self) -> bool
fn is_invalid(&self) -> bool
§impl Hash for NullableHandle
impl Hash for NullableHandle
§impl Ord for NullableHandle
impl Ord for NullableHandle
§impl PartialEq for NullableHandle
impl PartialEq for NullableHandle
§impl PartialOrd for NullableHandle
impl PartialOrd for NullableHandle
impl Eq for NullableHandle
impl StructuralPartialEq for NullableHandle
Auto Trait Implementations§
impl Freeze for NullableHandle
impl RefUnwindSafe for NullableHandle
impl Send for NullableHandle
impl Sync for NullableHandle
impl Unpin for NullableHandle
impl UnwindSafe for NullableHandle
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
§impl<T> EncodableAsHandle for Twhere
T: HandleBased,
impl<T> EncodableAsHandle for Twhere
T: HandleBased,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
Source§fn from_wire_option(wire: WireBox<'_, W>) -> Option<T>
fn from_wire_option(wire: WireBox<'_, W>) -> Option<T>
wire to an option of this type.Source§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
Source§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to Self