edlcodegen-macros
This crate provides the procedural macros used by structs and enums generated from EDL definitions.
The macros automatically generates conversion code between the developer-facing EDL types and their corresponding generated target representations (e.g., schema-generated types used for serialization like FlatBuffers).
-
#[derive(EdlDerive)]together with#[target_struct(path::Type)]— generates impls for thecore::convert::Fromtrait to convert between an EDL-generated struct and its corresponding target struct type. -
#[derive(EdlDerive)]together with#[target_enum(path::Type)]— generates impls for thecore::convert::Fromtrait to convert between an EDL-generated enum and its corresponding target enum type.
Example
#[derive(EdlDerive)]
#[target_struct(GeneratedModule::NestedStructT)]
pub struct NestedStruct {
pub id: u32,
pub name: String,
pub active: bool,
}
#[derive(EdlDerive)]
#[target_enum(GeneratedModule::Color)]
pub enum Color {
Red,
Green,
Blue,
}