Struct CopyBuffer

Source
pub struct CopyBuffer<B, SR, SW> { /* private fields */ }
Expand description

A wrapper of its underlying buffer(array, vector, unix pipe…).

Implementations§

Source§

impl<B, SR, SW> CopyBuffer<B, SR, SW>

Source

pub const fn new(buf: B) -> Self

Constructor, take the provided buffer.

Source§

impl<B, SR, SW> CopyBuffer<B, SR, SW>
where B: Unpin, SR: AsyncRead + AsyncWrite + Unpin, SW: AsyncRead + AsyncWrite + Unpin, CopyBuffer<B, SR, SW>: AsyncIOBuf,

Source

pub fn poll_copy( &mut self, cx: &mut Context<'_>, r: &mut <CopyBuffer<B, SR, SW> as AsyncIOBuf>::StreamR, w: &mut <CopyBuffer<B, SR, SW> as AsyncIOBuf>::StreamW, ) -> Poll<Result<u64>>

Copy data from reader to writer via buffer, asynchronously.

Trait Implementations§

Source§

impl<'a, SR, SW> AsyncIOBuf for CopyBuffer<&'a mut Pipe, SR, SW>

Source§

type StreamR = SR

Source§

type StreamW = SW

Source§

fn poll_read_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamR, ) -> Poll<Result<usize>>

Source§

fn poll_write_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<usize>>

Source§

fn poll_flush_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<()>>

Source§

impl<B, SR, SW> AsyncIOBuf for CopyBuffer<B, SR, SW>
where B: AsMut<[u8]>, SR: AsyncRead + AsyncWrite + Unpin, SW: AsyncRead + AsyncWrite + Unpin,

Source§

type StreamR = SR

Source§

type StreamW = SW

Source§

fn poll_read_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamR, ) -> Poll<Result<usize>>

Source§

fn poll_write_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<usize>>

Source§

fn poll_flush_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<()>>

Source§

impl<SR, SW> AsyncIOBuf for CopyBuffer<Pipe, SR, SW>

Source§

type StreamR = SR

Source§

type StreamW = SW

Source§

fn poll_read_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamR, ) -> Poll<Result<usize>>

Source§

fn poll_write_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<usize>>

Source§

fn poll_flush_buf( &mut self, cx: &mut Context<'_>, stream: &mut Self::StreamW, ) -> Poll<Result<()>>

Auto Trait Implementations§

§

impl<B, SR, SW> Freeze for CopyBuffer<B, SR, SW>
where B: Freeze,

§

impl<B, SR, SW> RefUnwindSafe for CopyBuffer<B, SR, SW>

§

impl<B, SR, SW> Send for CopyBuffer<B, SR, SW>
where B: Send, SR: Send, SW: Send,

§

impl<B, SR, SW> Sync for CopyBuffer<B, SR, SW>
where B: Sync, SR: Sync, SW: Sync,

§

impl<B, SR, SW> Unpin for CopyBuffer<B, SR, SW>
where B: Unpin, SR: Unpin, SW: Unpin,

§

impl<B, SR, SW> UnwindSafe for CopyBuffer<B, SR, SW>
where B: UnwindSafe, SR: UnwindSafe, SW: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.