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
25/// Derive which automatically implements the [`Decode` trait].
26///
27/// See the [`derives` module] for detailed documentation.
28///
29/// [`derives` module]: <https://docs.rs/musli/latest/musli/_help/derives/index.html>
30/// [`Decode` trait]: <https://docs.rs/musli/latest/musli/trait.Decode.html>
31///
32/// # Examples
33///
34/// ```
35/// use musli_core::Decode;
36///
37/// #[derive(Decode)]
38/// #[musli(crate = musli_core)]
39/// struct MyType {
40///     data: [u8; 128],
41/// }
42/// ```
43#[doc(inline)]
44pub use musli_macros::Decode;
45
46#[doc(inline)]
47pub use self::__traits::*;
48
49mod as_decoder;
50mod decode;
51mod decode_bytes;
52mod decode_owned;
53mod decode_packed;
54mod decode_slice_builder;
55mod decode_trace;
56mod decode_unsized;
57mod decode_unsized_bytes;
58mod decoder;
59mod entries_decoder;
60mod entry_decoder;
61mod map_decoder;
62mod sequence_decoder;
63mod size_hint;
64mod skip;
65mod unsized_visitor;
66mod variant_decoder;
67mod visitor;
68
69#[doc(hidden)]
70pub mod __traits {
71    pub use super::as_decoder::AsDecoder;
72    pub use super::decode::Decode;
73    pub use super::decode_bytes::DecodeBytes;
74    pub use super::decode_owned::DecodeOwned;
75    pub use super::decode_packed::DecodePacked;
76    pub use super::decode_slice_builder::DecodeSliceBuilder;
77    pub use super::decode_trace::DecodeTrace;
78    pub use super::decode_unsized::DecodeUnsized;
79    pub use super::decode_unsized_bytes::DecodeUnsizedBytes;
80    pub use super::decoder::{Decoder, TryFastDecode};
81    pub use super::entries_decoder::EntriesDecoder;
82    pub use super::entry_decoder::EntryDecoder;
83    pub use super::map_decoder::MapDecoder;
84    pub use super::sequence_decoder::SequenceDecoder;
85    pub use super::size_hint::SizeHint;
86    pub use super::skip::Skip;
87    pub use super::unsized_visitor::UnsizedVisitor;
88    pub use super::variant_decoder::VariantDecoder;
89    pub use super::visitor::Visitor;
90}
91
92#[doc(hidden)]
93pub mod utils;