Module de

Module de 

Source
Expand description

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.

Note that using derives directly from musli_core requires you to use the #[musli(crate = musli_core)] attribute.

§Examples

use musli_core::Decode;

#[derive(Decode)]
#[musli(crate = musli_core)]
pub struct Person<'a> {
    name: &'a str,
    age: u32,
}

Enums§

Skip
Indicates if skipping was performed.
TryFastDecode
An outcome of a fast decode attempt.

Traits§

AsDecoder
Trait that allows a type to be repeatedly coerced into a decoder.
Decode
Trait governing how types are decoded.
DecodeBytes
Trait governing how types are decoded as bytes.
DecodeOwned
Decode to an owned value.
DecodePacked
Trait governing how a type is decoded as a packed value.
DecodeSliceBuilder
Trait used to decode a slice into a type.
DecodeTrace
Trait governing how types are decoded specifically for tracing.
DecodeUnsized
A trait implemented for types which can only be decoded by reference.
DecodeUnsizedBytes
A trait implemented for types which can be visited by reference.
Decoder
Trait governing the implementation of a decoder.
EntriesDecoder
Trait governing how to decode a sequence of map pairs.
EntryDecoder
Trait governing how to decode a map entry.
MapDecoder
Trait governing how to decode a sequence of pairs.
SequenceDecoder
Trait governing how to decode a sequence.
UnsizedVisitor
A visitor for data where we might need to borrow without copying from the underlying Decoder.
VariantDecoder
Trait governing how to decode a variant.
Visitor
Visitor capable of decoding any type into a value Visitor::Ok.

Attribute Macros§

decoder
This is an attribute macro that must be used when implementing a Decoder.
unsized_visitor
This is an attribute macro that must be used when implementing a UnsizedVisitor.
visitor
This is an attribute macro that must be used when implementing a Visitor.

Derive Macros§

Decode
Derive which automatically implements the Decode trait.