Struct fuchsia_async::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.
§

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

§

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