Struct async_bincode::AsyncBincodeWriter [] [src]

pub struct AsyncBincodeWriter<W, T, D> { /* fields omitted */ }

A wrapper around an asynchronous sink that accepts, serializes, and sends bincode-encoded values.

To use, provide a writer that implements futures::AsyncWrite, and then use futures::Sink to send values.

Note that an AsyncBincodeWriter must be of the type [AsyncDestination] in order to be compatible with an [AsyncBincodeReader] on the remote end (recall that it requires the serialized size prefixed to the serialized data). The default is [SyncDestination], but these can be easily toggled between using [AsyncBincodeWriter::for_async].

Methods

impl<W, T, D> AsyncBincodeWriter<W, T, D>
[src]

[src]

Gets a reference to the underlying writer.

It is inadvisable to directly write to the underlying writer.

[src]

Gets a mutable reference to the underlying writer.

It is inadvisable to directly write to the underlying writer.

[src]

Unwraps this AsyncBincodeWriter, returning the underlying writer.

Note that any leftover serialized data that has not yet been sent is lost.

impl<W, T, D> AsyncBincodeWriter<W, T, D>
[src]

[src]

Make this writer include the serialized data's size before each serialized value.

This is necessary for compatability with [AsyncBincodeReader].

[src]

Make this writer only send bincode-encoded values.

This is necessary for compatability with stock bincode receivers.

Trait Implementations

impl<W: Debug, T: Debug, D: Debug> Debug for AsyncBincodeWriter<W, T, D>
[src]

[src]

Formats the value using the given formatter. Read more

impl<W, T> Default for AsyncBincodeWriter<W, T, SyncDestination> where
    W: Default
[src]

[src]

Returns the "default value" for a type. Read more

impl<W, T> From<W> for AsyncBincodeWriter<W, T, SyncDestination>
[src]

[src]

Performs the conversion.

impl<W, T, D> Sink for AsyncBincodeWriter<W, T, D> where
    T: Serialize,
    W: AsyncWrite,
    Self: BincodeWriterFor<T>, 
[src]

The type of value that the sink accepts.

The type of value produced by the sink when an error occurs.

[src]

Begin the process of sending a value to the sink. Read more

[src]

Flush all output from this sink, if necessary. Read more

[src]

A method to indicate that no more values will ever be pushed into this sink. Read more

[src]

Creates a new object which will produce a synchronous sink. Read more

[src]

Composes a function in front of the sink. Read more

[src]

Composes a function in front of the sink. Read more

[src]

Transforms the error returned by the sink.

[src]

Map this sink's error to any error implementing From for this sink's Error, returning a new sink. Read more

[src]

Adds a fixed-size buffer to the current sink. Read more

[src]

Fanout items to multiple sinks. Read more

[src]

A future that completes when the sink has finished processing all pending requests. Read more

[src]

A future that completes after the given item has been fully processed into the sink, including flushing. Read more

[src]

A future that completes after the given stream has been fully processed into the sink, including flushing. Read more

Auto Trait Implementations

impl<W, T, D> Send for AsyncBincodeWriter<W, T, D> where
    D: Send,
    T: Send,
    W: Send

impl<W, T, D> Sync for AsyncBincodeWriter<W, T, D> where
    D: Sync,
    T: Sync,
    W: Sync