Struct fidl::handle::AsyncChannel

pub struct AsyncChannel(/* private fields */);
Expand description

An I/O object representing a Channel.

Implementations§

§

impl Channel

pub fn from_channel(channel: Channel) -> Channel

Creates a new Channel from a previously-created zx::Channel.

§Panics

If called outside the context of an active async executor.

pub fn into_zx_channel(self) -> Channel

Consumes self and returns the underlying zx::Channel.

pub fn is_closed(&self) -> bool

Returns true if the channel received the OBJECT_PEER_CLOSED signal.

pub fn on_closed<'a>(&'a self) -> OnSignals<'a>

Returns a future that completes when is_closed() is true.

pub fn read( &self, cx: &mut Context<'_>, bytes: &mut Vec<u8>, handles: &mut Vec<Handle> ) -> Poll<Result<(), Status>>

Receives a message on the channel and registers this Channel as needing a read on receiving a zx::Status::SHOULD_WAIT.

Identical to recv_from except takes separate bytes and handles buffers rather than a single MessageBuf.

pub fn read_etc( &self, cx: &mut Context<'_>, bytes: &mut Vec<u8>, handles: &mut Vec<HandleInfo> ) -> Poll<Result<(), Status>>

Receives a message on the channel and registers this Channel as needing a read on receiving a zx::Status::SHOULD_WAIT.

Identical to recv_etc_from except takes separate bytes and handles buffers rather than a single MessageBufEtc.

pub fn recv_from( &self, cx: &mut Context<'_>, buf: &mut MessageBuf ) -> Poll<Result<(), Status>>

Receives a message on the channel and registers this Channel as needing a read on receiving a zx::Status::SHOULD_WAIT.

pub fn recv_etc_from( &self, cx: &mut Context<'_>, buf: &mut MessageBufEtc ) -> Poll<Result<(), Status>>

Receives a message on the channel and registers this Channel as needing a read on receiving a zx::Status::SHOULD_WAIT.

pub fn recv_msg<'a>(&'a self, buf: &'a mut MessageBuf) -> RecvMsg<'a>

Creates a future that receive a message to be written to the buffer provided.

The returned future will return after a message has been received on this socket and been placed into the buffer.

pub fn recv_etc_msg<'a>(&'a self, buf: &'a mut MessageBufEtc) -> RecvEtcMsg<'a>

Creates a future that receive a message to be written to the buffer provided.

The returned future will return after a message has been received on this socket and been placed into the buffer.

pub fn write(&self, bytes: &[u8], handles: &mut [Handle]) -> Result<(), Status>

Writes a message into the channel.

pub fn write_etc( &self, bytes: &[u8], handles: &mut [HandleDisposition<'_>] ) -> Result<(), Status>

Writes a message into the channel.

Trait Implementations§

§

impl AsHandleRef for Channel

§

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

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>

Set and clear userspace-accessible signal bits on an object. Wraps the zx_object_signal syscall.
§

fn wait_handle( &self, signals: Signals, deadline: Time ) -> Result<Signals, Status>

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>

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<CString, Status>

Get the [Property::NAME] property for this object. Read more
§

fn set_name(&self, name: &CStr) -> Result<(), Status>

Set the [Property::NAME] property for this object. Read more
§

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>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.
§

fn get_koid(&self) -> Result<Koid, Status>

Returns the koid (kernel object ID) for this handle.
§

impl AsRef<Channel> for Channel

§

fn as_ref(&self) -> &Channel

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl ChannelEpitaphExt for AsyncChannel

source§

fn close_with_epitaph(self, status: Status) -> Result<(), Error>

Consumes the channel and writes an epitaph.
§

impl Debug for Channel

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<Channel> for Channel

§

fn from(channel: Channel) -> Channel

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more