musli_core/de/
mod.rs

1//! Traits for generically dealing with a decoding framework.
2//!
3//! The central traits are [Decode] and [Decoder].
4//!
5//! A type implementing [Decode] can use an [Decoder] to decode an instance of
6//! itself. This also comes with a derive allowing you to derive high
7//! performance decoding associated with native Rust types.
8//!
9//! Note that using derives directly from `musli_core` requires you to use the
10//! `#[musli(crate = musli_core)]` attribute.
11//!
12//! # Examples
13//!
14//! ```
15//! use musli_core::Decode;
16//!
17//! #[derive(Decode)]
18//! #[musli(crate = musli_core)]
19//! pub struct Person<'a> {
20//!     name: &'a str,
21//!     age: u32,
22//! }
23//! ```
24
25pub use musli_macros::Decode;
26
27mod as_decoder;
28pub use self::as_decoder::AsDecoder;
29
30mod decode;
31pub use self::decode::Decode;
32
33mod decode_bytes;
34pub use self::decode_bytes::DecodeBytes;
35
36mod decode_packed;
37pub use self::decode_packed::DecodePacked;
38
39mod decode_trace;
40pub use self::decode_trace::DecodeTrace;
41
42mod decode_unsized;
43pub use self::decode_unsized::DecodeUnsized;
44
45mod decode_unsized_bytes;
46pub use self::decode_unsized_bytes::DecodeUnsizedBytes;
47
48mod decoder;
49pub use self::decoder::Decoder;
50
51mod entries_decoder;
52pub use self::entries_decoder::EntriesDecoder;
53
54mod entry_decoder;
55pub use self::entry_decoder::EntryDecoder;
56
57mod map_decoder;
58pub use self::map_decoder::MapDecoder;
59
60mod sequence_decoder;
61pub use self::sequence_decoder::SequenceDecoder;
62
63mod size_hint;
64pub use self::size_hint::SizeHint;
65
66mod skip;
67pub use self::skip::Skip;
68
69mod unsized_visitor;
70pub use self::unsized_visitor::UnsizedVisitor;
71
72mod variant_decoder;
73pub use self::variant_decoder::VariantDecoder;
74
75mod visitor;
76pub use self::visitor::Visitor;
77
78/// Decode to an owned value.
79///
80/// This is a simpler bound to use than `for<'de> Decode<'de, M>`.
81pub trait DecodeOwned<M>: for<'de> Decode<'de, M> {}
82
83impl<M, D> DecodeOwned<M> for D where D: for<'de> Decode<'de, M> {}