Skip to main content

Crate musli_core

Crate musli_core 

Source
Expand description

github crates.io docs.rs

Core traits for Müsli.

The Encode and Decode derives exported by this crate generate code which refers to musli_core, so a crate which depends on musli_core alone derives them without a #[musli(crate = ..)] attribute:

use musli_core::{Decode, Encode};

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

If musli_core is renamed in Cargo.toml, such as with musli_core01 = { package = "musli-core", .. }, the derives have to be told the new name with #[musli(crate = musli_core01)].

Re-exports§

pub use self::de::Decode;
pub use self::de::Decoder;
pub use self::en::Encode;
pub use self::en::Encoder;

Modules§

alloc
Müsli Rust core allocation and collections library
de
Traits for generically dealing with a decoding framework.
display
Encode a value through Display and decode it through FromStr.
en
Traits for generically dealing with an encoding framework.
hint
Core encoding hints.
mode
Type that describe a mode of encoding.

Traits§

Allocator
An allocator that can be used in combination with a context.
Context
Provides ergonomic access to the serialization context.
Decode
Trait governing how types are decoded.
Decoder
Trait governing how decoding is implemented for a given format.
Encode
Trait governing how types are encoded.
Encoder
Trait governing how encoding is implemented for a given format.

Attribute Macros§

trait_defaults
This is an attribute macro that must be used when implementing the following traits:

Derive Macros§

Decode
Derive which automatically implements the Decode trait.
Encode
Derive which automatically implements the Encode trait.