Crate dialectic_tokio_serde[][src]

This crate provides an interface to build a family of backend implementations using the serde crate to transport Serialize and Deserialize values by reference across any AsyncRead and AsyncWrite transports. In order to use it, you will need to depend on some other crate which provides the definition of a serialization format; none such are defined here.

To use this backend, select:

Then, use symmetrical(_with_capacity) to construct a pair of Sender and Receiver.

If your outgoing and incoming streams are encoded or serialized differently, or your serialization or encoding format is not Clone, use Sender::new and Receiver::new directly to construct each end of the connection.

Re-exports

pub use tokio_util::codec;

Structs

Receiver

A Receiver<F, D, R> is capable of receiving any Deserialize value using the serialization format F and the frame decoding D, from the asynchronous reader R.

Sender

A Sender<F, E, W> is capable of sending any Serialize value using the serialization format F and the frame encoding E to the asynchronous writer W.

Enums

Error

An error during operations on a Sender or Receiver, unifying SendError and RecvError.

RecvError

An error while receiving from a Receiver.

SendError

An error while sending on a Sender.

Traits

Deserializer

The deserialization end of a serialization format: an object which can deserialize to any non-lifetime-restricted Deserialize value.

Serializer

The serialization end of a serialization format: an object which can serialize any Serialize value.

Functions

symmetrical

Create a Sender/Receiver pair which use the same serialization format and frame encoding in both directions.

symmetrical_with_capacity

Create a Sender/Receiver pair which use the same serialization format and frame encoding in both directions, allocating an initial capacity for the read buffer on the receiver.

Type Definitions

SymmetricalChan

A Chan for the session type S and the environment E, using a symmetrical serialization/encoding and the AsyncWrite/AsyncRead pair W/R as transport.

SymmetricalError

Shorthand for an Error resulting from a symmetrically serialized/encoded connection.