Crate trimmer_derive [−] [src]
Derive implementation for trimmer template engine
Trimmer | Docs | Github | Crate
This crate allows to derive trimmer::Variable
trait.
Currently it supports two kinds of structures, a tuple structure with a single field (i.e. a newtype pattern):
extern crate trimmer; #[macro_use] extern crate trimmer_derive; #[derive(Debug, Variable)] struct Variable(String);
In this case, all methods of the variable implementation will be forwarded
to the enclosed type (and it must implement Variable
)
And for regular structures with named patterns:
extern crate trimmer; #[macro_use] extern crate trimmer_derive; #[derive(Debug, Variable)] struct Point { x: u32, y: u32, }
In this case, Point
will implement attr
method resolving x
and y
.
All fields must implement Variable
trait themselves.
Functions
derive_variable |
A derivation function for proc macro |