pub struct Handle { /* private fields */ }Expand description
A handle of unspecified type within a remote FDomain.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn id(&self) -> u32
pub fn id(&self) -> u32
Returns the ID of the Handle. This should be unique to the handle for its lifetime.
Sourcepub fn has_client(&self) -> bool
pub fn has_client(&self) -> bool
Checks if there is an active client for this handle.
Only really useful if you are doing something when this function returning false,
and you want to fail fast with a specific error.
Sourcepub fn as_unowned<H: HandleBased>(&self) -> Unowned<H>
pub fn as_unowned<H: HandleBased>(&self) -> Unowned<H>
Convert this into an unowned handle (one that is borrowed and will not close when dropped).
An example:
let handle: &Handle = /* ... */;
let socket = handle.as_unowned::<fdomain_client::Socket>();
let mut buf: [u8; 4096] = [0; 4096];
socket.read(&mut buf[..]).await?;This is only really useful for contexts in which the handles are going to be stored and retrieved from a data structure and potentially used as arbitrary handle-based data types.
Trait Implementations§
Source§impl AsHandleRef for Handle
impl AsHandleRef for Handle
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
Get a HandleRef referring to the handle contained in Self
Source§fn object_type() -> ObjectType
fn object_type() -> ObjectType
Get the object type of this handle.
fn u32_id(&self) -> u32
fn signal_handle( &self, set: Signals, clear: Signals, ) -> impl Future<Output = Result<(), Error>>
Source§impl EncodableAsHandle for Handle
impl EncodableAsHandle for Handle
Source§type Dialect = FDomainResourceDialect
type Dialect = FDomainResourceDialect
What resource dialect can encode this object as a handle.
Source§impl<E: HandleEncoder + ?Sized> Encode<WireHandle, E> for Handle
impl<E: HandleEncoder + ?Sized> Encode<WireHandle, E> for Handle
Source§fn encode(
self,
encoder: &mut E,
out: &mut MaybeUninit<WireHandle>,
_: (),
) -> Result<(), EncodeError>
fn encode( self, encoder: &mut E, out: &mut MaybeUninit<WireHandle>, _: (), ) -> Result<(), EncodeError>
Encodes this value into an encoder and output.
Source§const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
Source§impl<E: HandleEncoder + ?Sized> EncodeOption<WireOptionalHandle, E> for Handle
impl<E: HandleEncoder + ?Sized> EncodeOption<WireOptionalHandle, E> for Handle
Source§fn encode_option(
this: Option<Self>,
encoder: &mut E,
out: &mut MaybeUninit<WireOptionalHandle>,
_: (),
) -> Result<(), EncodeError>
fn encode_option( this: Option<Self>, encoder: &mut E, out: &mut MaybeUninit<WireOptionalHandle>, _: (), ) -> Result<(), EncodeError>
Encodes this optional value into an encoder and output.
Source§impl From<Handle> for WireHandle
impl From<Handle> for WireHandle
Source§fn from(handle: Handle) -> WireHandle
fn from(handle: Handle) -> WireHandle
Converts to this type from the input type.
Source§impl FromWire<WireHandle> for Handle
impl FromWire<WireHandle> for Handle
Source§fn from_wire(wire: WireHandle) -> Self
fn from_wire(wire: WireHandle) -> Self
Converts the given
wire to this type.Source§const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
Source§impl FromWireOption<WireOptionalHandle> for Handle
impl FromWireOption<WireOptionalHandle> for Handle
Source§fn from_wire_option(wire: WireOptionalHandle) -> Option<Self>
fn from_wire_option(wire: WireOptionalHandle) -> Option<Self>
Converts the given
wire to an option of this type.Source§impl HandleBased for Handle
impl HandleBased for Handle
Source§fn invalidate(&mut self)
fn invalidate(&mut self)
Drop ownership of this handle and make it invalid, without closing the handle.
Source§fn close(self) -> impl Future<Output = Result<(), Error>>
fn close(self) -> impl Future<Output = Result<(), Error>>
Closes this handle. Surfaces errors that dropping the handle will not.
Source§fn duplicate_handle(
&self,
rights: Rights,
) -> impl Future<Output = Result<Self, Error>>
fn duplicate_handle( &self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>
Duplicate this handle.
Source§fn replace_handle(
self,
rights: Rights,
) -> impl Future<Output = Result<Self, Error>>
fn replace_handle( self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>
Replace this handle with an equivalent one with different rights.
Source§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
Convert this handle-based value into a pure
Handle.Source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
Construct a new handle-based value from a
Handle.Source§fn into_handle_based<H: HandleBased>(self) -> H
fn into_handle_based<H: HandleBased>(self) -> H
Turn this handle-based value into one of a different type.
Source§fn from_handle_based<H: HandleBased>(h: H) -> Self
fn from_handle_based<H: HandleBased>(h: H) -> Self
Turn another handle-based type into this one.
Source§impl HandleFor<FDomainResourceDialect> for Handle
impl HandleFor<FDomainResourceDialect> for Handle
Source§type HandleInfo = HandleInfo
type HandleInfo = HandleInfo
Handle info used in this dialect. Read more
Source§fn invalid() -> Self
fn invalid() -> Self
Produce an invalid version of
Handle used as a place filler when
we remove handles from an array.Source§fn is_invalid(&self) -> bool
fn is_invalid(&self) -> bool
Check whether a handle is invalid.
Source§impl Ord for Handle
impl Ord for Handle
Source§impl PartialOrd for Handle
impl PartialOrd for Handle
impl Eq for Handle
Auto Trait Implementations§
impl Freeze for Handle
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
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
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§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>
Converts the given
wire to an option of this type.§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]