pub trait AsyncStreamWriter {
    type WriteFuture<'a>: Future<Output = Result<()>> + 'a
       where Self: 'a;
    type WriteBytesFuture<'a>: Future<Output = Result<()>> + 'a
       where Self: 'a;
    type SyncFuture<'a>: Future<Output = Result<()>> + 'a
       where Self: 'a;

    // Required methods
    fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a>;
    fn write_bytes(&mut self, data: Bytes) -> Self::WriteBytesFuture<'_>;
    fn sync(&mut self) -> Self::SyncFuture<'_>;
}
Expand description

A non seekable writer, e.g. a network socket.

Required Associated Types§

source

type WriteFuture<'a>: Future<Output = Result<()>> + 'a where Self: 'a

Future returned by write

source

type WriteBytesFuture<'a>: Future<Output = Result<()>> + 'a where Self: 'a

Future returned by write

source

type SyncFuture<'a>: Future<Output = Result<()>> + 'a where Self: 'a

Future returned by sync

Required Methods§

source

fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a>

Write the entire slice.

In case of an error, some bytes may have been written.

source

fn write_bytes(&mut self, data: Bytes) -> Self::WriteBytesFuture<'_>

Write the entire bytes.

In case of an error, some bytes may have been written.

source

fn sync(&mut self) -> Self::SyncFuture<'_>

Sync any buffers to the underlying storage.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AsyncStreamWriter for Vec<u8>

§

type WriteFuture<'a> = Ready<Result<(), Error>>

source§

fn write(&mut self, data: &[u8]) -> Self::WriteFuture<'_>

§

type WriteBytesFuture<'a> = <Vec<u8> as AsyncStreamWriter>::WriteFuture<'a>

source§

fn write_bytes(&mut self, data: Bytes) -> Self::WriteBytesFuture<'_>

§

type SyncFuture<'a> = Ready<Result<(), Error>>

source§

fn sync(&mut self) -> Self::SyncFuture<'_>

source§

impl AsyncStreamWriter for BytesMut

§

type WriteFuture<'a> = Ready<Result<(), Error>>

source§

fn write(&mut self, data: &[u8]) -> Self::WriteFuture<'_>

§

type WriteBytesFuture<'a> = <BytesMut as AsyncStreamWriter>::WriteFuture<'a>

source§

fn write_bytes(&mut self, data: Bytes) -> Self::WriteBytesFuture<'_>

§

type SyncFuture<'a> = Ready<Result<(), Error>>

source§

fn sync(&mut self) -> Self::SyncFuture<'_>

source§

impl<T: AsyncStreamWriter> AsyncStreamWriter for &mut T

§

type WriteFuture<'a> = <T as AsyncStreamWriter>::WriteFuture<'a> where Self: 'a

source§

fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a>

§

type SyncFuture<'a> = <T as AsyncStreamWriter>::SyncFuture<'a> where Self: 'a

source§

fn sync(&mut self) -> Self::SyncFuture<'_>

§

type WriteBytesFuture<'a> = <T as AsyncStreamWriter>::WriteBytesFuture<'a> where Self: 'a

source§

fn write_bytes(&mut self, data: Bytes) -> Self::WriteBytesFuture<'_>

Implementors§

source§

impl<T: AsyncWrite + Unpin> AsyncStreamWriter for TokioStreamWriter<T>

§

type WriteFuture<'a> = Write<'a, T> where Self: 'a

§

type WriteBytesFuture<'a> = WriteBytes<'a, T> where Self: 'a

§

type SyncFuture<'a> = Flush<'a, T> where Self: 'a

source§

impl<W: AsyncStreamWriter> AsyncStreamWriter for TrackingStreamWriter<W>

§

type WriteFuture<'a> = AggregateStats<'a, <W as AsyncStreamWriter>::WriteFuture<'a>> where Self: 'a

§

type WriteBytesFuture<'a> = AggregateStats<'a, <W as AsyncStreamWriter>::WriteBytesFuture<'a>> where Self: 'a

§

type SyncFuture<'a> = AggregateStats<'a, <W as AsyncStreamWriter>::SyncFuture<'a>> where Self: 'a