mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 03:22:59 +00:00
cecae849aa
In short, this enables compilation of template of e.g. Vec<Commit> type by using CommitTemplateLanguage. A Template<C> was originally compiled for a specific type C, and invoked as "Fn(&C) -> _". It was simple and intuitive, but we had to define the context type C statically. Things got even worse by extensions support because we had to provide object-safe hook point for each context type C. This patch basically removes the Context type from compiled templates. The "self" variable is injected through RefCell<Option<C>> placeholder. A compiled template knows its "self" type, but the type can be decided per instance, not per TemplateLanguage type. A drawback is that the "self" variable will have to be cloned one more time. The Template<C> abstraction no longer makes sense, and will be split to inner Template<()> implementations (which usually represent printable types) and the outer Template<C>. |
||
---|---|---|
.. | ||
examples | ||
src | ||
testing | ||
tests | ||
build.rs | ||
Cargo.toml | ||
LICENSE |