pub struct Channel(/* private fields */);
Expand description
An I/O object representing a Channel
.
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn from_channel(channel: Channel) -> Self
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.
Sourcepub fn into_zx_channel(self) -> Channel
pub fn into_zx_channel(self) -> Channel
Consumes self
and returns the underlying zx::Channel
.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true if the channel received the OBJECT_PEER_CLOSED
signal.
Sourcepub fn on_closed(&self) -> OnSignalsRef<'_>
pub fn on_closed(&self) -> OnSignalsRef<'_>
Returns a future that completes when is_closed()
is true.
Sourcepub fn read(
&self,
cx: &mut Context<'_>,
bytes: &mut Vec<u8>,
handles: &mut Vec<Handle>,
) -> Poll<Result<(), Status>>
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
.
Sourcepub fn read_etc(
&self,
cx: &mut Context<'_>,
bytes: &mut Vec<u8>,
handles: &mut Vec<HandleInfo>,
) -> Poll<Result<(), Status>>
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
.
Sourcepub fn recv_from(
&self,
cx: &mut Context<'_>,
buf: &mut MessageBuf,
) -> Poll<Result<(), Status>>
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
.
Sourcepub fn recv_etc_from(
&self,
cx: &mut Context<'_>,
buf: &mut MessageBufEtc,
) -> Poll<Result<(), Status>>
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
.
Sourcepub fn recv_msg<'a>(&'a self, buf: &'a mut MessageBuf) -> RecvMsg<'a> ⓘ
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.
Sourcepub fn recv_etc_msg<'a>(&'a self, buf: &'a mut MessageBufEtc) -> RecvEtcMsg<'a>
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.
Trait Implementations§
Source§impl AsHandleRef for Channel
impl AsHandleRef for Channel
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
object_wait_many
.