1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! Encoding traits and types.
//!
//! Used to modify how request and response bodies are encoded and decoded.

mod encodable;
pub use encodable::*;

mod decodable;
pub use decodable::*;

/// Encode and decode data as JSON using `serde_json`.
#[cfg(any(doc, feature = "json"))]
#[derive(Clone, Debug)]
pub struct Json<T>(pub T);

/// Encode and decode data as YAML using `serde_yaml`.
#[cfg(any(doc, feature = "yaml"))]
#[derive(Clone, Debug)]
pub struct Yaml<T>(pub T);

/// Encode and decode data as postcard using `postcard`.
#[cfg(any(doc, feature = "postcard"))]
#[derive(Clone, Debug)]
pub struct Postcard<T>(pub T);

/// Encode and decode data as bincode using `bincode`.
#[cfg(any(doc, feature = "bincode"))]
#[derive(Clone, Debug)]
pub struct Bincode<T>(pub T);