fuchsia_async

Struct Channel

Source
pub struct Channel(/* private fields */);
Expand description

An I/O object representing a Channel.

Implementations§

Source§

impl Channel

Source

pub fn from_channel(channel: Channel) -> Self

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

§Panics

If called outside the context of an active async executor.

Source

pub fn into_zx_channel(self) -> Channel

Consumes self and returns the underlying zx::Channel.

Source

pub fn is_closed(&self) -> bool

Returns true if the channel received the OBJECT_PEER_CLOSED signal.

Source

pub fn on_closed(&self) -> OnSignalsRef<'_>

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Writes a message into the channel.

Source

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

Writes a message into the channel.

Trait Implementations§

Source§

impl AsHandleRef for Channel

Source§

fn as_handle_ref(&self) -> HandleRef<'_>

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

impl AsRef<Channel> for Channel

Source§

fn as_ref(&self) -> &Channel

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

impl Debug for Channel

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<Channel> for Channel

Source§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

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

Source§

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.