[−][src]Struct iovec::IoVec
A specialized byte slice type for performing vectored I/O operations.
On all systems, the types needed to perform vectored I/O systems have the
same size as Rust's slice
. However, the layout is not necessarily the
same. IoVec
provides a portable compatibility layer.
The IoVec
behaves like a Rust slice
, providing the same functions.
It also provides conversion functions to and from the OS specific vectored
types.
Examples
use iovec::IoVec; let mut data = vec![]; data.extend_from_slice(b"hello"); let iovec: IoVec = data.as_slice().into(); assert_eq!(&iovec[..], &b"hello"[..]);
Panics
Attempting to convert a zero-length slice or a slice longer than
MAX_LENGTH
to an IoVec
will result in a panic.
Methods
impl<'a> IoVec<'a>
[src]
pub fn from_bytes(slice: &'a [u8]) -> Self
[src]
Convert an IoVec
from a byte slice
pub fn from_mut_slice<'b>(slice: &'b [IoVecMut<'a>]) -> &'b [Self]
[src]
Convert a slice of mutable iovecs to immutable iovecs
pub fn borrow(&self) -> IoVec
[src]
Immutable borrow of the iovec.
Trait Implementations
impl<'a> From<&'a [u8]> for IoVec<'a>
[src]
impl<'a> Deref for IoVec<'a>
[src]
impl<'a> Default for IoVec<'a>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,