1 unstable release

0.1.0 Apr 6, 2019

#39 in #bincode

Download history 8/week @ 2024-07-27 1/week @ 2024-08-03 8/week @ 2024-08-17 7/week @ 2024-08-24 4/week @ 2024-08-31 1/week @ 2024-09-07 21/week @ 2024-09-21 26/week @ 2024-09-28 18/week @ 2024-10-05 29/week @ 2024-10-12 17/week @ 2024-10-19 5/week @ 2024-10-26 27/week @ 2024-11-02 20/week @ 2024-11-09

74 downloads per month

MIT license

8KB
130 lines

tokio-bincode

Build Status

Bincode based tokio-codec adapter.

Usage

First, add this to your Cargo.toml:

[dependencies]
tokio-bincode = "0.1"

Then you can use it like so:

#[derive(Serialize, Deserialize)]
struct MyProtocol;

// Create the codec based on your custom protocol
let codec = BinCodec::<MyProtocol>::new();

// Frame the transport with the codec to produce a stream/sink
let (sink, stream) = Framed::new(transport, codec).split();

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio-bincode by you, shall be licensed as MIT, without any additional terms or conditions.


lib.rs:

Tokio codec for use with bincode

This crate provides a bincode based codec that can be used with tokio's Framed, FramedRead, and FramedWrite.

Example

#[derive(Serialize, Deserialize)]
struct MyProtocol;

// Create the codec based on your custom protocol
let codec = BinCodec::<MyProtocol>::new();

// Frame the transport with the codec to produce a stream/sink
let (sink, stream) = Framed::new(transport, codec).split();

Dependencies

~0.9–1.3MB
~25K SLoC