pub struct HandleRef<'a>(/* private fields */);Expand description
A reference to a Handle. Can be derived from a Handle or any other
type implementing AsHandleRef.
Implementations§
Source§impl HandleRef<'_>
impl HandleRef<'_>
Sourcepub fn duplicate(
&self,
rights: Rights,
) -> impl Future<Output = Result<Handle, Error>> + 'static + use<>
pub fn duplicate( &self, rights: Rights, ) -> impl Future<Output = Result<Handle, Error>> + 'static + use<>
Replace this handle with a new handle to the same object, with different rights.
Sourcepub fn signal(
&self,
set: Signals,
clear: Signals,
) -> impl Future<Output = Result<(), Error>> + use<>
pub fn signal( &self, set: Signals, clear: Signals, ) -> impl Future<Output = Result<(), Error>> + use<>
Assert and deassert signals on this handle.
pub fn get_koid(&self) -> impl Future<Output = Result<u64, Error>>
Methods from Deref<Target = 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<'a> Ord for HandleRef<'a>
impl<'a> Ord for HandleRef<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialOrd for HandleRef<'a>
impl<'a> PartialOrd for HandleRef<'a>
impl<'a> Eq for HandleRef<'a>
impl<'a> StructuralPartialEq for HandleRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for HandleRef<'a>
impl<'a> !RefUnwindSafe for HandleRef<'a>
impl<'a> Send for HandleRef<'a>
impl<'a> Sync for HandleRef<'a>
impl<'a> Unpin for HandleRef<'a>
impl<'a> !UnwindSafe for HandleRef<'a>
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
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,
§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
T to [Self]