| Crates.io | endurox-derive |
| lib.rs | endurox-derive |
| version | 0.1.0 |
| created_at | 2025-11-08 19:27:58.921438+00 |
| updated_at | 2025-11-08 19:27:58.921438+00 |
| description | Derive macros for Enduro/X UBF buffer serialization |
| homepage | https://github.com/serdzz/endurox-rust |
| repository | https://github.com/serdzz/endurox-rust |
| max_upload_size | |
| id | 1923200 |
| size | 17,934 |
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.
#[derive(UbfStructDerive)] - Automatic UBF serialization/deserialization#[ubf_field(id)] - Map struct fields to UBF field IDsAdd this to your Cargo.toml:
[dependencies]
endurox-sys = { version = "0.1", features = ["derive"] }
use endurox_sys::{UbfStruct, UbfStructDerive};
#[derive(UbfStructDerive)]
struct Transaction {
#[ubf_field(100)]
transaction_id: String,
#[ubf_field(101)]
amount: i64,
#[ubf_field(102)]
status: String,
}
// Automatic conversion to/from UBF buffers
fn process_transaction(ubf_buf: *mut UBFH) -> Result<(), UbfError> {
let txn = Transaction::from_ubf(ubf_buf)?;
// Process transaction...
txn.to_ubf(ubf_buf)?;
Ok(())
}
The #[ubf_field(id)] attribute maps struct fields to UBF field IDs:
#[derive(UbfStructDerive)]
struct Request {
#[ubf_field(1000)] // Maps to UBF field ID 1000
request_id: String,
#[ubf_field(1001)]
data: Vec<u8>,
}
String - Maps to BFLD_STRINGi16, i32, i64 - Maps to BFLD_SHORT, BFLD_LONG, BFLD_LONGf32, f64 - Maps to BFLD_FLOAT, BFLD_DOUBLEVec<u8> - Maps to BFLD_CARRAYendurox-sys crate with UBF feature enabledFor complete API documentation, see docs.rs/endurox-derive.
Licensed under the MIT license. See LICENSE for details.
endurox-sys - Low-level FFI bindings to Enduro/X