herolib-derive
Derive macros for herolib-core providing:
ToSchema- Generate JSON Schema from Rust structsToHeroScript- Serialize Rust structs to HeroScript formatFromHeroScript- Deserialize HeroScript into Rust structs
Documentation
Installation
This crate is typically used as a dependency of herolib-core. Users should depend on herolib-core which re-exports these macros.
[]
= "0.1"
Building
Usage
The derive macros are re-exported from herolib-core::heroscript:
use ;
// Serialize to HeroScript
let person = Person ;
let hs = person.to_heroscript;
// Output:
// !!person.define
// name:John
// age:30
// active:true
// Deserialize from HeroScript
let script = "!!person.define name:Jane age:25 active:false";
let jane = from_heroscript.unwrap;
License
Apache-2.0