21 releases

0.8.0 Aug 13, 2024
0.7.3 Dec 20, 2023
0.7.2 Oct 27, 2023
0.7.0 Jul 3, 2023
0.3.0 Feb 1, 2021

#617 in Encoding

Download history 80/week @ 2024-08-16 63/week @ 2024-08-23 101/week @ 2024-08-30 46/week @ 2024-09-06 69/week @ 2024-09-13 93/week @ 2024-09-20 65/week @ 2024-09-27 30/week @ 2024-10-04 38/week @ 2024-10-11 31/week @ 2024-10-18 19/week @ 2024-10-25 69/week @ 2024-11-01 16/week @ 2024-11-08 21/week @ 2024-11-15 42/week @ 2024-11-22 56/week @ 2024-11-29

137 downloads per month
Used in 27 crates (26 directly)

Apache-2.0

82KB
1.5K SLoC

destream

Rust library for asynchronous stream (de)serialization


lib.rs:

Provides traits FromStream, Decoder, ToStream and Encoder, which are streaming/async analogues of serde's Deserialize, Deserializer, Serialize, and Serializer.

The structure and contents of this crate are based on serde but not compatible with it (primarily because serde doesn't support async). Most of the code which makes up destream is copied directly from serde with minimal modifications.

serde is dual-licensed under the MIT and Apache-2.0 licenses, which are available at https://github.com/serde-rs/serde/blob/master/LICENSE-MIT and https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE respectively.

Important differences between destream and serde:

  • destream supports decoding from and encoding to a futures::Stream (obviously).
  • destream does not (yet) support the derive macro, so you can't derive FromStream or ToStream, and there is no built-in functionality for decoding/encoding a given struct.
  • Decoder assumes the static lifetime and only supports owned types, but Encoder uses a specific lifetime 'en. This is the opposite of serde.

destream itself does not implement support for any specific serialization format. destream_json provides support for streaming JSON.

Dependencies

~1.4–2.2MB
~43K SLoC