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.
The derive in this module generates code which refers to musli_core, so a
crate which depends on musli_core alone can use it without a
#[musli(crate = ..)] attribute. If the dependency is renamed in
Cargo.toml, point the derive at the new name with
#[musli(crate = <name>)].
§Examples
use musli_core::Encode;
#[derive(Encode)]
pub struct Person<'a> {
name: &'a str,
age: u32,
}Enums§
- TryFast
Encode - An outcome of a fast encode attempt.
Traits§
- Encode
- Trait governing how types are encoded.
- Encode
Bytes - Trait governing how a type is encoded as bytes.
- Encode
Packed - Trait governing how a type is encoded as a packed value.
- Encode
Trace - Trait governing how types are encoded specifically for tracing.
- Encoder
- Trait governing how encoding is implemented for a given format.
- Entries
Encoder - Trait governing how to encode a map entry.
- Entry
Encoder - Trait governing how to encode a map entry.
- MapEncoder
- Encoder for a map.
- Sequence
Encoder - Trait governing how to encode a sequence.
- Variant
Encoder - Trait governing how to encode a variant.
Derive Macros§
- Encode
- Derive which automatically implements the
Encodetrait.