Sha256: 0c9b588dfd9da039dc123ba9448ac31ca21ee3da0a164a21f6c2c182183d43e2

Contents?: true

Size: 792 Bytes

Versions: 27

Compression:

Stored size: 792 Bytes

Contents

use futures_core::future::Future;
use futures_core::task::{Context, Poll};
use futures_io::AsyncWrite;
use std::io;
use std::pin::Pin;

/// Future for the [`flush`](super::AsyncWriteExt::flush) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Flush<'a, W: ?Sized> {
    writer: &'a mut W,
}

impl<W: ?Sized + Unpin> Unpin for Flush<'_, W> {}

impl<'a, W: AsyncWrite + ?Sized + Unpin> Flush<'a, W> {
    pub(super) fn new(writer: &'a mut W) -> Self {
        Self { writer }
    }
}

impl<W> Future for Flush<'_, W>
where
    W: AsyncWrite + ?Sized + Unpin,
{
    type Output = io::Result<()>;

    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        Pin::new(&mut *self.writer).poll_flush(cx)
    }
}

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/futures-util-0.3.31/src/io/flush.rs
wasmtime-29.0.0 ./ext/cargo-vendor/futures-util-0.3.31/src/io/flush.rs
wasmtime-28.0.0 ./ext/cargo-vendor/futures-util-0.3.31/src/io/flush.rs
wasmtime-27.0.0 ./ext/cargo-vendor/futures-util-0.3.31/src/io/flush.rs
wasmtime-26.0.0 ./ext/cargo-vendor/futures-util-0.3.31/src/io/flush.rs
wasmtime-25.0.2 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-25.0.1 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-25.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-24.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-23.0.2 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-22.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-21.0.1 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-20.0.2 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-20.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-18.0.3 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-17.0.1 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-17.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-16.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-15.0.1 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs
wasmtime-15.0.0 ./ext/cargo-vendor/futures-util-0.3.30/src/io/flush.rs