Skip to main content

WriteFullyFuture

Struct WriteFullyFuture 

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

Future that writes every item from its source slice.

Items accepted before cancellation remain written. The accepted count is observable through Self::items_written.

To preserve executor fairness, one outer poll performs a bounded number of successful inner writes. The future self-wakes and returns Poll::Pending when that budget is exhausted before completion.

§Panics

Future::poll panics when called again after this future has returned Poll::Ready.

§Type Parameters

  • 'a: Shared lifetime of the output borrow and source slice.
  • O: Asynchronous output type.

Implementations§

Source§

impl<'a, O> WriteFullyFuture<'a, O>
where O: AsyncOutput + ?Sized,

Source

pub const fn new(output: Pin<&'a mut O>, input: &'a [O::Item]) -> Self

Creates a write-fully future from a pinned output.

§Parameters
  • output: Pinned asynchronous output.
  • input: Source storage.
§Returns

Returns a future that resolves after every item has been accepted.

Source

pub const fn items_written(&self) -> usize

Returns the number of items written so far.

§Returns

Returns the progress retained across polls.

Trait Implementations§

Source§

impl<O> Future for WriteFullyFuture<'_, O>
where O: AsyncOutput + ?Sized,

Source§

type Output = Result<(), Error>

Result produced when the write-fully operation becomes ready.

Source§

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

Polls the write-fully operation.

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

Returns Poll::Pending while more output capacity is needed, or Poll::Ready after all items are written or an error occurs.

§Errors

Returns ErrorKind::WriteZero if the output accepts no item before completion. Other errors are propagated from the output.

§Panics

Panics when polled after returning Poll::Ready.

Auto Trait Implementations§

§

impl<'a, O> !UnwindSafe for WriteFullyFuture<'a, O>

§

impl<'a, O> Freeze for WriteFullyFuture<'a, O>
where Pin<&'a mut O>: Freeze, &'a [<O as AsyncOutput>::Item]: Freeze, O: ?Sized,

§

impl<'a, O> RefUnwindSafe for WriteFullyFuture<'a, O>

§

impl<'a, O> Send for WriteFullyFuture<'a, O>
where Pin<&'a mut O>: Send, &'a [<O as AsyncOutput>::Item]: Send, O: ?Sized,

§

impl<'a, O> Sync for WriteFullyFuture<'a, O>
where Pin<&'a mut O>: Sync, &'a [<O as AsyncOutput>::Item]: Sync, O: ?Sized,

§

impl<'a, O> Unpin for WriteFullyFuture<'a, O>
where Pin<&'a mut O>: Unpin, &'a [<O as AsyncOutput>::Item]: Unpin, O: ?Sized,

§

impl<'a, O> UnsafeUnpin for WriteFullyFuture<'a, O>
where Pin<&'a mut O>: UnsafeUnpin, &'a [<O as AsyncOutput>::Item]: UnsafeUnpin, 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<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
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.