destream/lib.rs
1//! Provides traits [`FromStream`], [`Decoder`], [`ToStream`] and [`Encoder`], which are
2//! streaming/async analogues of [`serde`]'s `Deserialize`, `Deserializer`, `Serialize`,
3//! and `Serializer`.
4//!
5//! The structure and contents of this crate are based on [`serde`] but not compatible with it
6//! (primarily because [`serde`] doesn't support `async`).
7//! Most of the code which makes up `destream` is copied directly from [`serde`]
8//! with minimal modifications.
9//!
10//! [`serde`] is dual-licensed under the MIT and Apache-2.0 licenses, which are available at
11//! [https://github.com/serde-rs/serde/blob/master/LICENSE-MIT](https://github.com/serde-rs/serde/blob/master/LICENSE-MIT)
12//! and
13//! [https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE](https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE)
14//! respectively.
15//!
16//! Important differences between `destream` and `serde`:
17//! - `destream` supports decoding from and encoding to a `futures::Stream` (obviously).
18//! - `destream` does not (yet) support the `derive` macro, so you can't derive `FromStream` or
19//! `ToStream`, and there is no built-in functionality for decoding/encoding a given `struct`.
20//! - `Decoder` assumes the static lifetime and only supports owned types, but `Encoder` uses a
21//! specific lifetime `'en`. This is the opposite of `serde`.
22//!
23//! `destream` itself does not implement support for any specific serialization format.
24//! [`destream_json`] provides support for streaming JSON.
25//!
26//! [`destream_json`]: http://docs.rs/destream_json/
27//! [`serde`]: http://docs.rs/serde
28
29pub mod de;
30pub mod en;
31
32pub use de::{ArrayAccess, Decoder, FromStream, IgnoredAny, MapAccess, SeqAccess, Visitor};
33pub use en::{
34 EncodeMap, EncodeSeq, EncodeTuple, Encoder, IntoStream, MapStream, SeqStream, ToStream,
35};