Struct fidl::handle::fuchsia_handles::Handle
source · pub struct Handle(/* 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 Handle
impl Handle
sourcepub const fn invalid() -> Handle
pub const fn invalid() -> Handle
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
sourcepub const unsafe fn from_raw(raw: u32) -> Handle
pub const unsafe fn from_raw(raw: u32) -> Handle
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:
raw
may be closed manually and the returnedHandle
must not be dropped.- Or
raw
must not be closed until the returnedHandle
is dropped, at which time it will closeraw
.
pub fn is_invalid(&self) -> bool
pub fn replace(self, rights: Rights) -> Result<Handle, Status>
Trait Implementations§
source§impl AsHandleRef for Handle
impl AsHandleRef for Handle
source§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.source§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
source§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
source§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> Result<Signals, Status>
source§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>
source§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
source§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
source§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
source§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
source§impl From<Handle> for SuspendToken
impl From<Handle> for SuspendToken
source§impl From<SuspendToken> for Handle
impl From<SuspendToken> for Handle
source§fn from(x: SuspendToken) -> Handle
fn from(x: SuspendToken) -> Handle
source§impl HandleBased for Handle
impl HandleBased for Handle
source§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
source§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
source§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
source§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
source§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
source§impl HandleFor<DefaultFuchsiaResourceDialect> for Handle
impl HandleFor<DefaultFuchsiaResourceDialect> for Handle
§type HandleInfo = HandleInfo
type HandleInfo = HandleInfo
source§fn invalid() -> Self
fn invalid() -> Self
Handle
used as a place filler when
we remove handles from an array.source§fn is_invalid(&self) -> bool
fn is_invalid(&self) -> bool
source§impl Ord for Handle
impl Ord for Handle
source§impl PartialEq for Handle
impl PartialEq for Handle
source§impl PartialOrd for Handle
impl PartialOrd for Handle
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more