Skip to main content

Crate lencode_macros

Crate lencode_macros 

Source
Expand description

Derive macros for lencode encoding/decoding traits.

  • #[derive(Encode)] implements lencode::Encode by writing fields in declaration order and encoding enum discriminants compactly.
  • #[derive(Decode)] implements lencode::Decode to read the same layout.
  • #[derive(Pack)] implements lencode::pack::Pack by packing/unpacking fields in declaration order. For #[repr(transparent)] single‑field structs, it additionally generates bulk pack_slice/unpack_vec overrides that transmute to/from the inner type’s slice/vec, enabling zero‑copy bulk I/O for newtypes over byte arrays.

For C‑like enums with an explicit #[repr(uN/iN)], the numeric value of the discriminant is preserved; otherwise, the variant index is used.

Derive Macros§

Decode
Derives lencode::Decode for structs and enums.
Encode
Derives lencode::Encode for structs and enums.
Pack
Derives lencode::pack::Pack for structs.