Module en

Module en 

Source
Expand description

Traits for generically dealing with an encoding framework.

The central traits are Encode and Encoder.

A type implementing Encode can use an Encoder to encode itself. This also comes with a derive allowing you to derive high performance encoding 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::Encode;

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

Enums§

TryFastEncode
An outcome of a fast encode attempt.

Traits§

Encode
Trait governing how types are encoded.
EncodeBytes
Trait governing how a type is encoded as bytes.
EncodePacked
Trait governing how a type is encoded as a packed value.
EncodeTrace
Trait governing how types are encoded specifically for tracing.
Encoder
Trait governing how the encoder works.
EntriesEncoder
Trait governing how to encode a map entry.
EntryEncoder
Trait governing how to encode a map entry.
MapEncoder
Encoder for a map.
SequenceEncoder
Trait governing how to encode a sequence.
VariantEncoder
Trait governing how to encode a variant.

Attribute Macros§

encoder
This is an attribute macro that must be used when implementing a Encoder.

Derive Macros§

Encode
Derive which automatically implements the Encode trait.