Skip to main content

BoxAsyncOutput

Struct BoxAsyncOutput 

Source
pub struct BoxAsyncOutput<O>
where O: AsyncOutput + ?Sized,
{ /* private fields */ }
Expand description

Adapts an owned pinned boxed asynchronous output, including a trait object.

§Type Parameters

  • O: The boxed asynchronous output type, which may be unsized and non-Unpin.

Implementations§

Source§

impl<O> BoxAsyncOutput<O>
where O: AsyncOutput + ?Sized,

Source

pub fn new(inner: Box<O>) -> Self

Creates an asynchronous output adapter around inner.

§Parameters
  • inner: Boxed asynchronous output to pin and adapt.
§Returns

Returns an adapter that owns and pins inner.

Source

pub fn get_ref(&self) -> &O

Returns a shared reference to the boxed asynchronous output.

§Returns

Returns the wrapped asynchronous output.

Source

pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut O>

Projects a pinned adapter to its pinned boxed asynchronous output.

§Returns

Returns a pinned mutable reference to the wrapped output without moving it.

Source

pub fn into_inner(self) -> Pin<Box<O>>

Consumes this adapter and returns its pinned boxed asynchronous output.

§Returns

Returns the pinned boxed output so a potentially non-Unpin value stays pinned after extraction.

Trait Implementations§

Source§

impl<O> AsyncClose for BoxAsyncOutput<O>
where O: AsyncClose + ?Sized,

Source§

fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Forwards an asynchronous close to the pinned boxed output.

§Parameters
  • cx: Task context used to register a wake-up.
§Returns

Returns a pending state or the wrapped output’s ready close result.

§Errors

Returns an error reported while closing the wrapped output.

Source§

fn close_async(&mut self) -> CloseFuture<'_, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that closes this output. Read more
Source§

impl<O> AsyncOutput for BoxAsyncOutput<O>
where O: AsyncOutput + ?Sized,

Source§

type Item = <O as AsyncOutput>::Item

Item type written to the wrapped asynchronous output.

Source§

fn is_buffered(&self) -> bool

Returns the wrapped output’s buffering capability.

§Returns

Returns true when the wrapped output is buffered.

Source§

unsafe fn poll_write_unchecked( self: Pin<&mut Self>, cx: &mut Context<'_>, input: &[Self::Item], index: usize, count: usize, ) -> Poll<Result<usize>>

Forwards an unchecked asynchronous write to the pinned boxed output.

§Parameters
  • cx: Task context used to register a wake-up.
  • input: Source item slice.
  • index: Starting source index.
  • count: Maximum number of items to write.
§Returns

Returns a pending state or the wrapped output’s ready write result.

§Errors

Returns an error reported by the wrapped output.

§Safety

The range index..index + count must be valid for input.

Source§

fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Forwards an asynchronous flush to the pinned boxed output.

§Parameters
  • cx: Task context used to register a wake-up.
§Returns

Returns a pending state or the wrapped output’s ready flush result.

§Errors

Returns an error reported while flushing the wrapped output.

Source§

fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, input: &[Self::Item], ) -> Poll<Result<usize>>

Polls one write from the full source slice. Read more
Source§

fn write_async<'a>( &'a mut self, input: &'a [Self::Item], ) -> WriteFuture<'a, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that performs one asynchronous write operation. Read more
Source§

fn write_fully_async<'a>( &'a mut self, input: &'a [Self::Item], ) -> WriteFullyFuture<'a, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that writes the entire source slice. Read more
Source§

fn flush_async(&mut self) -> FlushFuture<'_, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that flushes internally buffered items. Read more

Auto Trait Implementations§

§

impl<O> Freeze for BoxAsyncOutput<O>
where Pin<Box<O>>: Freeze, O: ?Sized,

§

impl<O> RefUnwindSafe for BoxAsyncOutput<O>
where Pin<Box<O>>: RefUnwindSafe, O: ?Sized,

§

impl<O> Send for BoxAsyncOutput<O>
where Pin<Box<O>>: Send, O: ?Sized,

§

impl<O> Sync for BoxAsyncOutput<O>
where Pin<Box<O>>: Sync, O: ?Sized,

§

impl<O> Unpin for BoxAsyncOutput<O>
where Pin<Box<O>>: Unpin, O: ?Sized,

§

impl<O> UnsafeUnpin for BoxAsyncOutput<O>
where Pin<Box<O>>: UnsafeUnpin, O: ?Sized,

§

impl<O> UnwindSafe for BoxAsyncOutput<O>
where Pin<Box<O>>: UnwindSafe, O: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.