Struct fidl::handle::fuchsia_handles::Fifo
pub struct Fifo(/* private fields */);
Expand description
An object representing a Zircon fifo.
As essentially a subtype of Handle
, it can be freely interconverted.
Implementations§
§impl Fifo
impl Fifo
pub fn create(
elem_count: usize,
elem_size: usize
) -> Result<(Fifo, Fifo), Status>
pub fn create( elem_count: usize, elem_size: usize ) -> Result<(Fifo, Fifo), Status>
Create a pair of fifos and return their endpoints. Writing to one endpoint enqueues an element into the fifo from which the opposing endpoint reads. Wraps the zx_fifo_create syscall.
pub fn write(&self, elem_size: usize, bytes: &[u8]) -> Result<usize, Status>
pub fn write(&self, elem_size: usize, bytes: &[u8]) -> Result<usize, Status>
Attempts to write some number of elements into the fifo. The length of bytes
must be
divisible by elem_size
, which must match the fifo’s element size.
On success, returns the number of elements actually written.
Wraps zx_fifo_write.
pub unsafe fn write_ptr(
&self,
elem_size: usize,
bytes: *const u8,
count: usize
) -> Result<usize, Status>
pub unsafe fn write_ptr( &self, elem_size: usize, bytes: *const u8, count: usize ) -> Result<usize, Status>
Attempts to write some number of elements into the fifo. bytes
must
be at least elem_size * count
bytes long. On success, returns the
number of elements actually written.
Wraps zx_fifo_write.
§Safety
The caller is responsible for ensuring bytes
points to valid and
initialized memory at least elem_size * count
bytes long.
pub fn read(&self, elem_size: usize, bytes: &mut [u8]) -> Result<usize, Status>
pub fn read(&self, elem_size: usize, bytes: &mut [u8]) -> Result<usize, Status>
Attempts to read some number of elements out of the fifo. The length of bytes
must be
divisible by elem_size
, which must match the fifo’s element size.
On success, returns the number of elements actually read.
Wraps zx_fifo_read.
pub unsafe fn read_ptr(
&self,
elem_size: usize,
bytes: *mut u8,
count: usize
) -> Result<usize, Status>
pub unsafe fn read_ptr( &self, elem_size: usize, bytes: *mut u8, count: usize ) -> Result<usize, Status>
Attempts to read some number of elements out of the fifo. bytes
must
be at least elem_size * count
bytes long. On success, returns the
number of elements actually read.
Wraps zx_fifo_read.
§Safety
The caller is responsible for ensuring bytes
points to valid (albeit
not necessarily initialized) memory at least elem_size * count
bytes
long.
Trait Implementations§
§impl AsHandleRef for Fifo
impl AsHandleRef for Fifo
§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals ) -> Result<(), Status>
§fn wait_handle(
&self,
signals: Signals,
deadline: Time
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: Time ) -> Result<Signals, Status>
§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts ) -> Result<(), Status>
§fn get_name(&self) -> Result<CString, Status>
fn get_name(&self) -> Result<CString, Status>
§fn set_name(&self, name: &CStr) -> Result<(), Status>
fn set_name(&self, name: &CStr) -> Result<(), Status>
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
§impl HandleBased for Fifo
impl HandleBased for Fifo
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn is_invalid_handle(&self) -> bool
§impl Ord for Fifo
impl Ord for Fifo
§impl PartialOrd for Fifo
impl PartialOrd for Fifo
§fn partial_cmp(&self, other: &Fifo) -> Option<Ordering>
fn partial_cmp(&self, other: &Fifo) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more