maghoff / bart

A compile time templating language for Rust inspired by Mustache
https://crates.io/crates/bart
MIT License
37 stars 7 forks source link

Support rendering with trait objects #16

Closed maghoff closed 7 years ago

maghoff commented 7 years ago

Presently, a trait object can only expose functions. These are not renderable with Bart. It can be useful to render a heterogeneous list of things, which is most naturally expressed in Rust as an iterable of trait objects (eg &[&Trait]).

Bart could support trait objects by somehow supporting rendering of functions. Maybe something like {{function_call()}}, or maybe some shenanigans in Rust might let us allow {{function_call}} directly?