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(&self) -> OnSignals<'_, Unowned<'_, Handle>>

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.
source§

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).
source§

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.
source§

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

Waits on a handle. Wraps the zx_object_wait_one syscall.
source§

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.
source§

fn get_name(&self) -> Result<Name, Status>

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

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

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

fn basic_info(&self) -> Result<HandleBasicInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_BASIC topic.
source§

fn count_info(&self) -> Result<HandleCountInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.
source§

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.
source§

impl ChannelLike for AsyncChannel

source§

fn write_epitaph(&self, bytes: &[u8]) -> Result<(), TransportError>

Write an epitaph to a channel. Same as write_etc but is never fed handles.
§

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.
source§

impl ProxyChannelFor<DefaultFuchsiaResourceDialect> for AsyncChannel

§

type Boxed = FuchsiaProxyBox

Box we put around a ProxyChannel when using it within a client.
§

type Error = Status

Type of the errors we get from this proxy channel.
§

type HandleDisposition = HandleDisposition<'static>

Handle disposition used in this dialect. Read more
source§

fn boxed(self) -> FuchsiaProxyBox

Construct a new box around a proxy channel.
source§

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

Write data to a Proxy channel

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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