Encoding

Derive Macro Encoding 

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

Derive Encoding for structs.

Skipped fields fall back to Default.

use spongefish::Encoding;

#[derive(Encoding)]
struct Rgb {
    r: u8,
    g: u8,
    b: u8,
}

let colors = Rgb { r: 1, g: 2, b: 3 };
let data = colors.encode();
assert_eq!(data.as_ref(), [1, 2, 3]);