Skip to main content

Encode

Derive Macro Encode 

Source
#[derive(Encode)]
{
    // Attributes available to this derive:
    #[musli]
}
Expand description

Derive which automatically implements the Encode trait.

See the derives module for detailed documentation.

ยงExamples

use musli::Encode;

#[derive(Encode)]
struct MyType {
    data: [u8; 128],
}

Through musli_core it works the same way, with no crate attribute:

use musli_core::Encode;

#[derive(Encode)]
struct MyType {
    data: [u8; 128],
}

A crate which renames musli_core, such as with musli_core01 = { package = "musli-core", .. } in Cargo.toml, has to name it with #[musli(crate = musli_core01)].