Expand description
Crate zerodds-flatdata-derive. Safety classification: STANDARD
(the proc-macro generates unsafe impl FlatStruct — layout
guarantees are checked by the macro itself, not by a caller comment).
#[derive(FlatStruct)] for
zerodds_flatdata::FlatStruct.
Spec: docs/specs/zerodds-flatdata-1.0.md §1.2 (derive macro).
§Layer position
Layer 4 — Core Services (proc-macro for zerodds-flatdata).
§Public API (as of 1.0.0-rc.1)
#[derive(FlatStruct)]— generatesunsafe impl FlatStruct for TwithTYPE_HASH = sha256(type_name + field_layout)[..16].
§Compile-time checks
The macro rejects with compile_error! when:
Tis anenumorunion(layout not stable).Tcarries neither#[repr(C)]nor#[repr(transparent)](the default repr is undefined).
The Copy + 'static + Send + Sync bounds are enforced by the trait
itself — the compiler emits understandable errors when attempting to
derive on a non-Copy type.
§Example
ⓘ
use zerodds_flatdata_derive::FlatStruct;
#[derive(Copy, Clone, FlatStruct)]
#[repr(C)]
struct Pose { x: f64, y: f64, z: f64 }Derive Macros§
- Flat
Struct #[derive(FlatStruct)]— generiertunsafe impl FlatStruct for T.