Expand description
§Ronky Derive Macro Library
This crate provides procedural macros for the ronky library, enabling seamless implementation
of traits and boilerplate code generation for working with Arri schemas.
§Derive Macros
This crate provides two main derive macros:
§Exported
The primary macro that implements the Exportable trait for structs and enums.
This trait facilitates the conversion of types into representations defined by the arri_repr crate.
§Serializable
Implements the Serializable trait for structs, providing automatic JSON serialization
with field name transformations (snake_case to camelCase) and special handling for metadata
and nullable fields.
§Features
- Derive macros for implementing the
ExportableandSerializabletraits. - Simplifies the process of converting types to
arri_reprrepresentations. - Automatic field name transformations and special field detection.
- Designed to integrate tightly with the
ronkycrate.
§Usage
§Exported Macro
Use the Exported macro to automatically implement the Exportable trait for your types:
use ronky_derive::Exported;
#[derive(Exported)]
struct MySchema {
name: String,
value: i32,
}§Serializable Macro
Use the Serializable macro for automatic JSON serialization with field mapping:
use ronky_derive::Serializable;
#[derive(Serializable)]
struct ApiSchema {
field_name: String, // becomes "fieldName" in JSON
is_deprecated: Option<bool>, // becomes "isDeprecated"
metadata: Option<MetadataSchema>, // enables set_metadata()
nullable: Option<bool>, // enables set_nullable()
}If you’re looking for the crate that provides the core schema manipulation utilities, you are probably looking for the ronky crate.
Macros§
- export_
stream - A procedural macro to export a struct or enum.
Derive Macros§
- Exported
- A procedural macro to derive the
Exportedtrait for structs and enums. - Serializable
- A procedural macro to derive the
Serializabletrait for structs.