我可以在 Vibed 的 Diet 源代码中看到 void compileDietString(string diet_code, ALIASES...)(OutputStream stream__)
函数。
我看到它需要无限数量的别名作为模板参数。
这些别名是什么?我很难通过源代码搞清楚,它使用了很多概念,比如特征和混合,我不太了解。
最佳答案
这些参数是从 render
和 renderCompat
传递过来的。来自 the documentation of renderCompat
:
All following arguments must be pairs of a type and a string, each specifying one parameter. Parameter values can be passed either as a value of the same type as specified by the template arguments, or as a Variant which has the same type stored.
例子:
string title = "Hello, World!";
int pageNumber = 1;
res.renderCompat!("mytemplate.jd",
string, "title",
int, "pageNumber")
(title, pageNumber);
关于d - vibe.d 的 Diet 模板中的别名是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23372744/