Skip to main content

Crate pack_io_derive

Crate pack_io_derive 

Source
Expand description

Procedural macros for pack-io.

Three derives are provided:

  • #[derive(Serialize)] — implements pack_io::Serialize.
  • #[derive(Deserialize)] — implements pack_io::Deserialize (owning).
  • #[derive(DeserializeView)] — implements pack_io::DeserializeView for types whose fields borrow from the input buffer (&'a str, &'a [u8], primitives).

All three work on structs (named, tuple, unit) and enums (any variant shape). Field order in the source code is the encoded byte order; the wire format adds a varint(variant_index) prefix for enums.

This crate is not intended to be used directly — depend on pack-io with the derive feature instead, which re-exports the macros at pack_io::{Serialize, Deserialize, DeserializeView}.

Derive Macros§

Deserialize
Derive pack_io::Deserialize for a struct or enum (owning decode).
DeserializeView
Derive pack_io::DeserializeView for a struct or enum (zero-copy decode).
Serialize
Derive pack_io::Serialize for a struct or enum.