compio_buf

Trait IoVectoredBuf

Source
pub trait IoVectoredBuf: 'static {
    type Buf: IoBuf;
    type OwnedIter: OwnedIterator<Inner = Self> + IoBuf;

    // Required methods
    fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, Self::Buf>>;
    fn owned_iter(self) -> Result<Self::OwnedIter, Self>
       where Self: Sized;

    // Provided method
    unsafe fn io_slices(&self) -> Vec<IoSlice> { ... }
}
Expand description

A trait for vectored buffers.

Required Associated Types§

Source

type Buf: IoBuf

The buffer.

Source

type OwnedIter: OwnedIterator<Inner = Self> + IoBuf

The owned iterator that wraps Self.

Required Methods§

Source

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, Self::Buf>>

An iterator over the buffers that’s either owned or borrowed with MaybeOwned.

Source

fn owned_iter(self) -> Result<Self::OwnedIter, Self>
where Self: Sized,

Wrap self into an owned iterator.

Provided Methods§

Source

unsafe fn io_slices(&self) -> Vec<IoSlice>

Collected IoSlices of the buffers.

§Safety

The return slice will not live longer than self. It is static to provide convenience from writing self-referenced structure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: IoBuf> IoVectoredBuf for &'static [T]

Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<&'static [T]>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Source§

impl<T: IoBuf> IoVectoredBuf for &'static mut [T]

Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<&'static mut [T]>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Source§

impl<T: IoBuf, A: Allocator + 'static> IoVectoredBuf for Vec<T, A>

Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<Vec<T, A>>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Source§

impl<T: IoBuf, const N: usize> IoVectoredBuf for [T; N]

Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<[T; N]>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Source§

impl<T: IoBuf, const N: usize> IoVectoredBuf for ArrayVec<T, N>

Available on crate feature arrayvec only.
Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<ArrayVec<T, N>>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Source§

impl<T: IoBuf, const N: usize> IoVectoredBuf for SmallVec<[T; N]>
where [T; N]: Array<Item = T>,

Available on crate feature smallvec only.
Source§

type Buf = T

Source§

type OwnedIter = IndexedIter<SmallVec<[T; N]>>

Source§

fn iter_buf(&self) -> impl Iterator<Item = MaybeOwned<'_, T>>

Source§

fn owned_iter(self) -> Result<Self::OwnedIter, Self>

Implementors§