Struct fidl::handle::fuchsia_handles::Stream
pub struct Stream(/* private fields */);
Expand description
An object representing a Zircon stream.
As essentially a subtype of Handle
, it can be freely interconverted.
Implementations§
§impl Stream
impl Stream
pub fn create(
options: StreamOptions,
vmo: &Vmo,
offset: u64
) -> Result<Stream, Status>
pub fn create( options: StreamOptions, vmo: &Vmo, offset: u64 ) -> Result<Stream, Status>
See zx_stream_create
pub unsafe fn readv(
&self,
options: StreamReadOptions,
iovecs: &mut [zx_iovec_t]
) -> Result<usize, Status>
pub unsafe fn readv( &self, options: StreamReadOptions, iovecs: &mut [zx_iovec_t] ) -> Result<usize, Status>
Wraps the
zx_stream_readv
syscall.
§Safety
The caller is responsible for ensuring that the buffers in iovecs
point to valid (albeit
not necessarily initialized) memory.
pub fn read_uninit(
&self,
options: StreamReadOptions,
buffer: &mut [MaybeUninit<u8>]
) -> Result<usize, Status>
pub fn read_uninit( &self, options: StreamReadOptions, buffer: &mut [MaybeUninit<u8>] ) -> Result<usize, Status>
Attempts to read buffer.len()
bytes from the stream starting at the stream’s current seek
offset. Only the number of bytes read from the stream will be initialized in buffer
.
Returns the number of bytes read from the stream.
See zx_stream_readv.
pub fn read_to_vec(
&self,
options: StreamReadOptions,
length: usize
) -> Result<Vec<u8>, Status>
pub fn read_to_vec( &self, options: StreamReadOptions, length: usize ) -> Result<Vec<u8>, Status>
Attempts to read length
bytes from the stream starting at the stream’s current seek
offset. Returns the read bytes as a Vec
.
See zx_stream_readv.
pub unsafe fn readv_at(
&self,
options: StreamReadOptions,
offset: u64,
iovecs: &mut [zx_iovec_t]
) -> Result<usize, Status>
pub unsafe fn readv_at( &self, options: StreamReadOptions, offset: u64, iovecs: &mut [zx_iovec_t] ) -> Result<usize, Status>
Wraps the
zx_stream_readv_at
syscall.
§Safety
The caller is responsible for ensuring that the buffers in iovecs
point to valid (albeit
not necessarily initialized) memory.
pub fn read_at_uninit(
&self,
options: StreamReadOptions,
offset: u64,
buffer: &mut [MaybeUninit<u8>]
) -> Result<usize, Status>
pub fn read_at_uninit( &self, options: StreamReadOptions, offset: u64, buffer: &mut [MaybeUninit<u8>] ) -> Result<usize, Status>
Attempts to read buffer.len()
bytes from the stream starting at offset
. Only the number
of bytes read from the stream will be initialized in buffer
. Returns the number of bytes
read from the stream.
See zx_stream_readv_at.
pub fn read_at_to_vec(
&self,
options: StreamReadOptions,
offset: u64,
length: usize
) -> Result<Vec<u8>, Status>
pub fn read_at_to_vec( &self, options: StreamReadOptions, offset: u64, length: usize ) -> Result<Vec<u8>, Status>
Attempts to read length
bytes from the stream starting at offset
. Returns the read bytes
as a Vec
.
See zx_stream_readv_at.
pub fn writev(
&self,
options: StreamWriteOptions,
iovecs: &[zx_iovec_t]
) -> Result<usize, Status>
pub fn writev( &self, options: StreamWriteOptions, iovecs: &[zx_iovec_t] ) -> Result<usize, Status>
Wraps the
zx_stream_writev
syscall.
pub fn write(
&self,
options: StreamWriteOptions,
buffer: &[u8]
) -> Result<usize, Status>
pub fn write( &self, options: StreamWriteOptions, buffer: &[u8] ) -> Result<usize, Status>
Writes buffer
to the stream at the stream’s current seek offset. Returns the number of
bytes written.
See zx_stream_writev.
Trait Implementations§
§impl AsHandleRef for Stream
impl AsHandleRef for Stream
§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 Stream
impl HandleBased for Stream
§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 Stream
impl Ord for Stream
§impl PartialOrd for Stream
impl PartialOrd for Stream
§fn partial_cmp(&self, other: &Stream) -> Option<Ordering>
fn partial_cmp(&self, other: &Stream) -> 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§impl Read for Stream
impl Read for Stream
§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read more§impl Seek for Stream
impl Seek for Stream
§fn seek(&mut self, pos: SeekFrom) -> Result<u64, Error>
fn seek(&mut self, pos: SeekFrom) -> Result<u64, Error>
1.55.0 · source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len
)§impl Write for Stream
impl Write for Stream
§fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)impl Eq for Stream
impl StructuralPartialEq for Stream
Auto Trait Implementations§
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnwindSafe for Stream
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, const OBJECT_TYPE: u32, const RIGHTS: u32> Decode<HandleType<T, OBJECT_TYPE, RIGHTS>> for Twhere
T: 'static + HandleBased,
impl<T, const OBJECT_TYPE: u32, const RIGHTS: u32> Decode<HandleType<T, OBJECT_TYPE, RIGHTS>> for Twhere
T: 'static + HandleBased,
source§impl<T> Encode<Ambiguous1> for T
impl<T> Encode<Ambiguous1> for T
source§impl<T> Encode<Ambiguous2> for T
impl<T> Encode<Ambiguous2> for T
source§impl<T, const OBJECT_TYPE: u32, const RIGHTS: u32> Encode<HandleType<T, OBJECT_TYPE, RIGHTS>> for Twhere
T: 'static + HandleBased,
impl<T, const OBJECT_TYPE: u32, const RIGHTS: u32> Encode<HandleType<T, OBJECT_TYPE, RIGHTS>> for Twhere
T: 'static + HandleBased,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<R> ReadBytesExt for R
impl<R> ReadBytesExt for R
§fn read_u8(&mut self) -> Result<u8, Error>
fn read_u8(&mut self) -> Result<u8, Error>
§fn read_i8(&mut self) -> Result<i8, Error>
fn read_i8(&mut self) -> Result<i8, Error>
§fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
fn read_u16<T>(&mut self) -> Result<u16, Error>where
T: ByteOrder,
§fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
fn read_i16<T>(&mut self) -> Result<i16, Error>where
T: ByteOrder,
§fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u24<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
§fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i24<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
§fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
fn read_u32<T>(&mut self) -> Result<u32, Error>where
T: ByteOrder,
§fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
fn read_i32<T>(&mut self) -> Result<i32, Error>where
T: ByteOrder,
§fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u48<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
§fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i48<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
§fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
fn read_u64<T>(&mut self) -> Result<u64, Error>where
T: ByteOrder,
§fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
fn read_i64<T>(&mut self) -> Result<i64, Error>where
T: ByteOrder,
§fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
fn read_u128<T>(&mut self) -> Result<u128, Error>where
T: ByteOrder,
§fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
fn read_i128<T>(&mut self) -> Result<i128, Error>where
T: ByteOrder,
§fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error>where
T: ByteOrder,
§fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error>where
T: ByteOrder,
§fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error>where
T: ByteOrder,
§fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error>where
T: ByteOrder,
§fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
fn read_f32<T>(&mut self) -> Result<f32, Error>where
T: ByteOrder,
§fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
fn read_f64<T>(&mut self) -> Result<f64, Error>where
T: ByteOrder,
§fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error>where
T: ByteOrder,
§fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error>where
T: ByteOrder,
§fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error>where
T: ByteOrder,
§fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error>where
T: ByteOrder,
§fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
§fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error>where
T: ByteOrder,
§fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error>where
T: ByteOrder,
§fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error>where
T: ByteOrder,
§fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error>where
T: ByteOrder,
§fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
§fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error>where
T: ByteOrder,
read_f32_into
instead