endurox-derive
Procedural macros for Enduro/X middleware integration in Rust.
This crate provides derive macros for automatic serialization and deserialization of Rust structs to/from UBF (Unified Buffer Format) buffers used by Enduro/X.
Features
#[derive(UbfStructDerive)]- Automatic UBF serialization/deserialization- Field attribute
#[ubf_field(id)]- Map struct fields to UBF field IDs - Support for nested structs and arrays
- Type-safe conversions between Rust types and UBF types
Usage
Add this to your Cargo.toml:
[]
= { = "0.1", = ["derive"] }
Basic Example
use ;
// Automatic conversion to/from UBF buffers
Field Mapping
The #[ubf_field(id)] attribute maps struct fields to UBF field IDs:
Supported Types
String- Maps toBFLD_STRINGi16,i32,i64- Maps toBFLD_SHORT,BFLD_LONG,BFLD_LONGf32,f64- Maps toBFLD_FLOAT,BFLD_DOUBLEVec<u8>- Maps toBFLD_CARRAY- Arrays and nested structs (with limitations)
Requirements
- Enduro/X installed and configured
endurox-syscrate with UBF feature enabled
Documentation
For complete API documentation, see docs.rs/endurox-derive.
License
Licensed under the MIT license. See LICENSE for details.
Related Crates
endurox-sys- Low-level FFI bindings to Enduro/X