Skip to main content

musli/
de.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//! ```
10//! use musli::Decode;
11//!
12//! #[derive(Decode)]
13//! pub struct Person<'a> {
14//!     name: &'a str,
15//!     age: u32,
16//! }
17//! ```
18
19/// Derive which automatically implements the [`Decode` trait].
20///
21/// See the [`derives` module] for detailed documentation.
22///
23/// [`derives` module]: crate::_help::derives
24/// [`Decode` trait]: trait@Decode
25///
26/// # Examples
27///
28/// ```
29/// use musli::Decode;
30///
31/// #[derive(Decode)]
32/// struct MyType {
33///     data: [u8; 128],
34/// }
35/// ```
36#[doc(inline)]
37pub use musli_core::__macros::Decode;
38
39#[doc(inline)]
40pub use musli_core::de::__traits::{
41    AsDecoder, Decode, DecodeBytes, DecodeOwned, DecodePacked, DecodeSliceBuilder, DecodeTrace,
42    DecodeUnsized, DecodeUnsizedBytes, Decoder, EntriesDecoder, EntryDecoder, MapDecoder,
43    SequenceDecoder, SizeHint, Skip, TryFastDecode, UnsizedVisitor, VariantDecoder, Visitor,
44};
45
46#[cfg(any(
47    feature = "storage",
48    feature = "wire",
49    feature = "descriptive",
50    feature = "value"
51))]
52pub(crate) use musli_core::de::utils;