pub type Token = Handle;
Expand description
The type to identify a connection to a node. It represents a capability: a reference to a node with associated rights.
Aliased Type§
struct Token(/* private fields */);
Implementations
§impl Handle
impl Handle
pub const fn invalid() -> Handle
pub const fn invalid() -> Handle
Initialize a handle backed by ZX_HANDLE_INVALID, the only safe non-handle.
pub 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
§impl AsHandleRef for Handle
impl AsHandleRef for Handle
§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
Get a reference to the handle. One important use of such a reference is
for
object_wait_many
.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
Interpret the reference as a raw handle (an integer type). Two distinct
handles will have different raw values (so it can perhaps be used as a
key in a data structure).
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
Set and clear userspace-accessible signal bits on an object. Wraps the
zx_object_signal
syscall.
§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> WaitResult
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
Waits on a handle. Wraps the
zx_object_wait_one
syscall.
§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>
Causes packet delivery on the given port when the object changes state and matches signals.
zx_object_wait_async
syscall.
§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
Get the [Property::NAME] property for this object. Read more
§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
Set the [Property::NAME] property for this object. Read more
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
Wraps the
zx_object_get_info
syscall for the ZX_INFO_HANDLE_BASIC topic.
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
Wraps the
zx_object_get_info
syscall for the ZX_INFO_HANDLE_COUNT topic.
§impl Encodable for Handle
impl Encodable for Handle
§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
An optimization flag that allows the bytes of this type to be copied directly during
encoding instead of calling
encode
. Read more§impl EncodableOption for Handle
impl EncodableOption for Handle
§type EncodedOption = WireOptionalHandle
type EncodedOption = WireOptionalHandle
The wire type for the optional value.
§impl<E> EncodeOption<E> for Handlewhere
E: HandleEncoder + ?Sized,
impl<E> EncodeOption<E> for Handlewhere
E: HandleEncoder + ?Sized,
§fn encode_option(
this: Option<Handle>,
encoder: &mut E,
out: &mut MaybeUninit<<Handle as EncodableOption>::EncodedOption>,
) -> Result<(), EncodeError>
fn encode_option( this: Option<Handle>, encoder: &mut E, out: &mut MaybeUninit<<Handle as EncodableOption>::EncodedOption>, ) -> Result<(), EncodeError>
Encodes this optional value into an encoder and output.
Source§impl From<AdvisoryLockingSynchronousProxy> for Handle
impl From<AdvisoryLockingSynchronousProxy> for Handle
Source§fn from(value: AdvisoryLockingSynchronousProxy) -> Handle
fn from(value: AdvisoryLockingSynchronousProxy) -> Handle
Converts to this type from the input type.
§impl<Reference, Output> From<Clock<Reference, Output>> for Handlewhere
Reference: Timeline,
Output: Timeline,
impl<Reference, Output> From<Clock<Reference, Output>> for Handlewhere
Reference: Timeline,
Output: Timeline,
Source§impl From<DirectorySynchronousProxy> for Handle
impl From<DirectorySynchronousProxy> for Handle
Source§fn from(value: DirectorySynchronousProxy) -> Handle
fn from(value: DirectorySynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<DirectoryWatcherSynchronousProxy> for Handle
impl From<DirectoryWatcherSynchronousProxy> for Handle
Source§fn from(value: DirectoryWatcherSynchronousProxy) -> Handle
fn from(value: DirectoryWatcherSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<ExtendedAttributeIteratorSynchronousProxy> for Handle
impl From<ExtendedAttributeIteratorSynchronousProxy> for Handle
Source§fn from(value: ExtendedAttributeIteratorSynchronousProxy) -> Handle
fn from(value: ExtendedAttributeIteratorSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<FileSynchronousProxy> for Handle
impl From<FileSynchronousProxy> for Handle
Source§fn from(value: FileSynchronousProxy) -> Handle
fn from(value: FileSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<LinkableSynchronousProxy> for Handle
impl From<LinkableSynchronousProxy> for Handle
Source§fn from(value: LinkableSynchronousProxy) -> Handle
fn from(value: LinkableSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<NodeSynchronousProxy> for Handle
impl From<NodeSynchronousProxy> for Handle
Source§fn from(value: NodeSynchronousProxy) -> Handle
fn from(value: NodeSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<ReadableSynchronousProxy> for Handle
impl From<ReadableSynchronousProxy> for Handle
Source§fn from(value: ReadableSynchronousProxy) -> Handle
fn from(value: ReadableSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<SymlinkSynchronousProxy> for Handle
impl From<SymlinkSynchronousProxy> for Handle
Source§fn from(value: SymlinkSynchronousProxy) -> Handle
fn from(value: SymlinkSynchronousProxy) -> Handle
Converts to this type from the input type.
Source§impl From<WritableSynchronousProxy> for Handle
impl From<WritableSynchronousProxy> for Handle
Source§fn from(value: WritableSynchronousProxy) -> Handle
fn from(value: WritableSynchronousProxy) -> Handle
Converts to this type from the input type.
§impl HandleBased for Handle
impl HandleBased for Handle
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
Duplicate a handle, possibly reducing the rights available. Wraps the
zx_handle_duplicate
syscall.
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
Create a replacement for a handle, possibly reducing the rights available. This invalidates
the original handle. Wraps the
zx_handle_replace
syscall.
§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
Converts the value into its inner handle. Read more
§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
Creates an instance of this type from a handle. Read more
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
Creates an instance of another handle-based type from this value’s inner handle.
§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
Creates an instance of this type from the inner handle of another
handle-based type.
fn is_invalid_handle(&self) -> bool
§impl HandleFor<DefaultFuchsiaResourceDialect> for Handle
impl HandleFor<DefaultFuchsiaResourceDialect> for Handle
§type HandleInfo = HandleInfo
type HandleInfo = HandleInfo
Handle info used in this dialect. Read more
§fn invalid() -> Handle
fn invalid() -> Handle
Produce an invalid version of
Handle
used as a place filler when
we remove handles from an array.§fn is_invalid(&self) -> bool
fn is_invalid(&self) -> bool
Check whether a handle is invalid.
§impl Ord for Handle
impl Ord for Handle
§impl PartialOrd for Handle
impl PartialOrd for Handle
§impl TakeFrom<WireHandle> for Handle
impl TakeFrom<WireHandle> for Handle
§fn take_from(from: &WireHandle) -> Handle
fn take_from(from: &WireHandle) -> Handle
Converts from the given
T
, taking any resources that can’t be cloned.§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
An optimization flag that allows the bytes of this type to be copied directly during
conversion instead of calling
take_from
. Read more