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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Traits for generically dealing with a decoding framework.
//!
//! The central traits are [Decode] and [Decoder].
//!
//! A type implementing [Decode] can use an [Decoder] to decode an instance of
//! itself. This also comes with a derive allowing you to derive high
//! performance decoding associated with native Rust types.
//!
//! ```
//! use musli::Decode;
//!
//! #[derive(Decode)]
//! pub struct Person<'a> {
//!     name: &'a str,
//!     age: u32,
//! }
//! ```

mod skip;
#[doc(inline)]
pub use self::skip::Skip;

mod size_hint;
#[doc(inline)]
pub use self::size_hint::SizeHint;

mod as_decoder;
#[doc(inline)]
pub use self::as_decoder::AsDecoder;

mod decode;
#[doc(inline)]
pub use self::decode::Decode;

mod decode_trace;
#[doc(inline)]
pub use self::decode_trace::DecodeTrace;

mod decode_unsized;
#[doc(inline)]
pub use self::decode_unsized::DecodeUnsized;

mod decode_unsized_bytes;
#[doc(inline)]
pub use self::decode_unsized_bytes::DecodeUnsizedBytes;

mod decode_bytes;
#[doc(inline)]
pub use self::decode_bytes::DecodeBytes;

mod decode_packed;
#[doc(inline)]
pub use self::decode_packed::DecodePacked;

mod decoder;
#[doc(inline)]
pub use self::decoder::Decoder;

mod map_decoder;
#[doc(inline)]
pub use self::map_decoder::MapDecoder;

mod entries_decoder;
#[doc(inline)]
pub use self::entries_decoder::EntriesDecoder;

mod entry_decoder;
#[doc(inline)]
pub use self::entry_decoder::EntryDecoder;

mod number_visitor;
#[doc(inline)]
pub use self::number_visitor::NumberVisitor;

mod sequence_decoder;
#[doc(inline)]
pub use self::sequence_decoder::SequenceDecoder;

mod value_visitor;
#[doc(inline)]
pub use self::value_visitor::ValueVisitor;

mod variant_decoder;
#[doc(inline)]
pub use self::variant_decoder::VariantDecoder;

mod visitor;
#[doc(inline)]
pub use self::visitor::Visitor;

/// Decode to an owned value.
///
/// This is a simpler bound to use than `for<'de> Decode<'de, M>`.
pub trait DecodeOwned<M>: for<'de> Decode<'de, M> {}

impl<M, D> DecodeOwned<M> for D where D: for<'de> Decode<'de, M> {}