Struct zircon_object::ipc::Channel[][src]

pub struct Channel { /* fields omitted */ }

Bidirectional interprocess communication

SYNOPSIS

A channel is a bidirectional transport of messages consisting of some amount of byte data and some number of handles.

DESCRIPTION

The process of sending a message via a channel has two steps. The first is to atomically write the data into the channel and move ownership of all handles in the message into this channel. This operation always consumes the handles: at the end of the call, all handles either are all in the channel or are all discarded. The second operation, channel read, is similar: on success all the handles in the next message are atomically moved into the receiving process’ handle table. On failure, the channel retains ownership.

Implementations

impl Channel[src]

pub fn create() -> (Arc<Self>, Arc<Self>)[src]

Create a channel and return a pair of its endpoints

pub fn check_and_read(
    &self,
    checker: impl FnOnce(&MessagePacket) -> ZxResult
) -> ZxResult<MessagePacket>
[src]

Read a packet from the channel if check is ok, otherwise the msg will keep.

pub fn read(&self) -> ZxResult<MessagePacket>[src]

Read a packet from the channel

pub fn write(&self, msg: MessagePacket) -> ZxResult[src]

Write a packet to the channel

pub async fn call(
    self: &Arc<Self>,
    msg: MessagePacket
) -> ZxResult<MessagePacket>
[src]

Send a message to a channel and await a reply.

The first four bytes of the written and read back messages are treated as a transaction ID. The kernel generates a txid for the written message, replacing that part of the message as read from userspace.

msg.data must have at lease a length of 4 bytes.

Trait Implementations

impl Debug for Channel[src]

impl Drop for Channel[src]

impl KernelObject for Channel[src]

Auto Trait Implementations

impl !RefUnwindSafe for Channel

impl Send for Channel

impl Sync for Channel

impl Unpin for Channel

impl !UnwindSafe for Channel

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.