Expand description
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:
- a particular serialization format, such as from the
dialectic_tokio_serde_bincodeordialectic_tokio_serde_jsoncrates, - a particular
codecfor encoding and decoding frames, and - your choice of
AsyncReadandAsyncWritereader and writer.
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 anyDeserializevalue using the serialization formatFand the frame decodingD, from the asynchronous readerR. - Sender
- A
Sender<F, E, W>is capable of sending anySerializevalue using the serialization formatFand the frame encodingEto the asynchronous writerW.
Enums§
- Error
- An error during operations on a
SenderorReceiver, unifyingSendErrorandRecvError. - Recv
Error - An error while receiving from a
Receiver. - Send
Error - 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
Deserializevalue. - Serializer
- The serialization end of a serialization format: an object which can serialize any
Serializevalue.
Functions§
- symmetrical
- Create a
Sender/Receiverpair which use the same serialization format and frame encoding in both directions. - symmetrical_
with_ capacity - Create a
Sender/Receiverpair which use the same serialization format and frame encoding in both directions, allocating an initial capacity for the read buffer on the receiver.
Type Aliases§
- Symmetrical
Chan - A
Chanfor the session typeSand the environmentE, using a symmetrical serialization/encoding and theAsyncWrite/AsyncReadpairW/Ras transport. - Symmetrical
Error - Shorthand for an
Errorresulting from a symmetrically serialized/encoded connection.