Skip to main content

FuturesOutput

Struct FuturesOutput 

Source
pub struct FuturesOutput<T> { /* private fields */ }
Expand description

Adapts a futures-io AsyncWrite value to Qubit’s AsyncOutput.

§Type Parameters

  • T: Futures-io writer type.

Implementations§

Source§

impl<T> FuturesOutput<T>

Source

pub const fn new(inner: T) -> Self

Creates an adapter around a futures-io writer.

§Parameters
  • inner: Futures-io writer to adapt.
§Returns

Returns a Qubit output adapter that owns inner.

Source

pub const fn get_ref(&self) -> &T

Returns a shared reference to the wrapped writer.

§Returns

Returns the wrapped futures-io writer.

Source

pub const fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the wrapped writer.

§Returns

Returns the wrapped futures-io writer with mutable access.

Source

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

Projects a pinned adapter to its pinned wrapped writer.

§Returns

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

Source

pub fn into_inner(self) -> T

Consumes the adapter and returns the wrapped writer.

§Returns

Returns the owned futures-io writer.

Trait Implementations§

Source§

impl<T> AsyncClose for FuturesOutput<T>
where T: AsyncWrite,

Source§

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

Polls closing through the wrapped futures-io writer.

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

Returns Poll::Pending while closing is incomplete, otherwise a ready success result.

§Errors

Returns an I/O error reported by the wrapped writer. Invalid asynchronous error kinds are normalized to std::io::ErrorKind::InvalidData.

Source§

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

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

impl<T> AsyncOutput for FuturesOutput<T>
where T: AsyncWrite,

Source§

type Item = u8

Byte item accepted by a futures-io writer.

Source§

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

Polls an indexed write through the wrapped futures-io writer.

A zero-length request completes immediately without polling inner.

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

Returns Poll::Pending when the writer is not ready. A ready result contains the number of bytes accepted.

§Errors

Returns an I/O error reported by the wrapped writer. Invalid asynchronous error kinds are normalized to std::io::ErrorKind::InvalidData.

§Panics

Panics in debug builds if the requested input range does not fit.

§Safety

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

Source§

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

Polls flushing through the wrapped futures-io writer.

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

Returns Poll::Pending while flushing is incomplete, otherwise a ready success result.

§Errors

Returns an I/O error reported by the wrapped writer. Invalid asynchronous error kinds are normalized to std::io::ErrorKind::InvalidData.

Source§

fn is_buffered(&self) -> bool

Returns whether this output already buffers items internally. Read more
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<T> Freeze for FuturesOutput<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for FuturesOutput<T>
where T: RefUnwindSafe,

§

impl<T> Send for FuturesOutput<T>
where T: Send,

§

impl<T> Sync for FuturesOutput<T>
where T: Sync,

§

impl<T> Unpin for FuturesOutput<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for FuturesOutput<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for FuturesOutput<T>
where T: 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 = !

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.