Struct magenta::Channel
[−]
[src]
pub struct Channel(_);
An object representing a Magenta channel.
As essentially a subtype of Handle
, it can be freely interconverted.
Methods
impl Channel
[src]
fn create(opts: ChannelOpts) -> Result<(Channel, Channel), Status>
Create a channel, resulting an a pair of Channel
objects representing both
sides of the channel. Messages written into one maybe read from the opposite.
Wraps the mx_channel_create syscall.
fn read_raw(
&self,
opts: u32,
buf: &mut MessageBuf
) -> Result<Result<(), Status>, (usize, usize)>
&self,
opts: u32,
buf: &mut MessageBuf
) -> Result<Result<(), Status>, (usize, usize)>
Read a message from a channel. Wraps the mx_channel_read syscall.
If the MessageBuf
lacks the capacity to hold the pending message,
returns an Err
with the number of bytes and number of handles needed.
Otherwise returns an Ok
with the result as usual.
fn read(&self, opts: u32, buf: &mut MessageBuf) -> Result<(), Status>
Read a message from a channel.
Note that this method can cause internal reallocations in the MessageBuf
if it is lacks capacity to hold the full message. If such reallocations
are not desirable, use read_raw
instead.
fn write(
&self,
bytes: &[u8],
handles: &mut Vec<Handle>,
opts: u32
) -> Result<(), Status>
&self,
bytes: &[u8],
handles: &mut Vec<Handle>,
opts: u32
) -> Result<(), Status>
Write a message to a channel. Wraps the mx_channel_write syscall.
fn call(
&self,
options: u32,
timeout: mx_time_t,
bytes: &[u8],
handles: &mut Vec<Handle>,
buf: &mut MessageBuf
) -> Result<(), (Status, Status)>
&self,
options: u32,
timeout: mx_time_t,
bytes: &[u8],
handles: &mut Vec<Handle>,
buf: &mut MessageBuf
) -> Result<(), (Status, Status)>
Send a message consisting of the given bytes and handles to a channel and await a reply. The bytes should start with a four byte 'txid' which is used to identify the matching reply.
Wraps the mx_channel_call syscall.
Note that unlike read
, the caller must ensure that the MessageBuf has enough
capacity for the bytes and handles which will be received, as replies which are too large
are discarded.
On failure returns the both the main and read status.
Trait Implementations
impl Debug for Channel
[src]
impl Eq for Channel
[src]
impl PartialEq for Channel
[src]
fn eq(&self, __arg_0: &Channel) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Channel) -> bool
This method tests for !=
.
impl AsHandleRef for Channel
[src]
fn as_handle_ref(&self) -> HandleRef
Get a reference to the handle. One important use of such a reference is for object_wait_many
. Read more
fn raw_handle(&self) -> mx_handle_t
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). Read more
fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals
) -> Result<(), Status>
&self,
clear_mask: Signals,
set_mask: Signals
) -> Result<(), Status>
Set and clear userspace-accessible signal bits on an object. Wraps the mx_object_signal syscall. Read more
fn wait_handle(
&self,
signals: Signals,
deadline: mx_time_t
) -> Result<Signals, Status>
&self,
signals: Signals,
deadline: mx_time_t
) -> Result<Signals, Status>
Waits on a handle. Wraps the mx_object_wait_one syscall. Read more
fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts
) -> Result<(), Status>
&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. mx_object_wait_async syscall. Read more
impl From<Handle> for Channel
[src]
impl Into<Handle> for Channel
[src]
impl HandleBased for Channel
[src]
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
Duplicate a handle, possibly reducing the rights available. Wraps the mx_handle_duplicate syscall. Read more
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
Create a replacement for a handle, possibly reducing the rights available. This invalidates the original handle. Wraps the mx_handle_replace syscall. Read more