Skip to main content

Pack

Derive Macro Pack 

Source
#[derive(Pack)]
Expand description

Derives lencode::pack::Pack for structs.

  • Fields are packed/unpacked in declaration order using their own Pack impls.
  • For #[repr(transparent)] single‑field structs, bulk pack_slice and unpack_vec overrides are generated that transmute to/from the inner type’s slice/vec, enabling zero‑copy bulk I/O for newtypes over byte arrays.

§Example

#[repr(transparent)]
#[derive(Pack)]
struct MyPubkey([u8; 32]);