funcfmt | 
funcfmt is a simple, lightweight templating library that allows templating using custom runtime context and function pointers. It was originally created for exifrename, to allow efficiently processing a format and set of callbacks across thousands of EXIF objects.
Usage
The basic flow of funcfmt looks like this:
- Given a
FormatMap<T>calledformatters, callformatters.to_format_pieces(), which preprocesses everything into aFormatPieces<T>, where&Tis what your callback function will take as its only argument. This allows avoiding having to reparse the formatters and go through the template each time things are processed. - Call .render(data) on the
FormatPieces<T>.
A very small example with Strings passed in, although you can pass an object
of any type:
use ;