Skip to main content

Crate byteable_derive

Crate byteable_derive 

Source
Expand description

Procedural macros for deriving byte conversion traits.

This crate provides procedural macros for automatically implementing byte conversion traits and I/O support on types.

§Main Macros

  • #[derive(Byteable)] - Generates byte conversion traits and I/O support

    • Fixed-size structs → IntoByteArray, FromByteArray (transmute-based)
    • Dynamic structs with #[byteable(io_only)]Readable, Writable (field I/O)
    • C-like enums → IntoByteArray, TryFromByteArray (transmute-based)
    • Enums with variant fields → Readable, Writable (stream I/O)
  • #[derive(UnsafeByteableTransmute)] - Lower-level transmute-based implementation (rarely needed; normally use #[derive(Byteable)] instead)

Derive Macros§

Byteable
Derives byte conversion and I/O traits for structs and enums.
UnsafeByteableTransmute
Derives byte conversion traits for a struct using transmute.