Expand description
#[derive(Gtmpl)] for gtmpl_value_ng: it generates the
From<YourStruct> for Value implementation that turns a struct into a template
context for gtmpl-ng.
use gtmpl_derive_ng::Gtmpl;
use gtmpl_value_ng::Value;
#[derive(Gtmpl)]
struct Foo {
bar: u8,
}
let v: Value = Foo { bar: 23 }.into();Every named field is converted with Into<Value>, so a field type only has to
implement that. The generated code names ::gtmpl_value_ng::Value by absolute
path, so gtmpl_value_ng has to be a dependency of the deriving crate too.
The README’s example is this one; a proc-macro crate cannot export the hidden item that would doc-test the file itself, so the two are kept in step by hand.