8 releases (3 stable)
1.1.1 | Dec 27, 2024 |
---|---|
1.1.0 | Aug 20, 2024 |
1.0.0 | Mar 22, 2024 |
0.1.5 | Feb 15, 2024 |
0.1.0 | Jun 14, 2021 |
#21 in #stratum
418 downloads per month
Used in 12 crates
(via binary_sv2)
130KB
3K
SLoC
derive_codec_sv2
derive-codec-sv2
is a no-std Rust crate offering procedural macros for automating serialization and deserialization of structs used within the Sv2 (Stratum V2) protocol. This crate provides Encodable
and Decodable
macros to streamline binary data handling, especially useful for protocol-level implementations where efficient encoding and decoding are essential.
Key Capabilities
- Automatic Encoding and Decoding: Derives methods for converting structs to and from binary format, reducing boilerplate code for data structures used in Sv2.
- Attribute-Based Configuration: Supports
#[already_sized]
attribute for marking fixed-size structs, enabling optimizations in binary handling. - Flexible Field Parsing: Allows parsing of fields with lifetimes, generics, and static references, enhancing compatibility with various protocol requirements.
- Custom Size Calculation: Provides field-specific size calculation through the derived
GetSize
trait, helpful for dynamic protocol message framing.
Usage
To include this crate in your project, run:
cargo add derive-codec-sv2