struct Template
pub struct Template {
pub src string
}Purpose
Structure encapsulating src.
Public fields
srcstring- source
#text/templateTemplates without reflection: {{.}}, pipelines, if/with/range/define.
struct Templatepub struct Template {
pub src string
}Structure encapsulating src.
src stringstruct Dictpub struct Dict {
pub keys []string
pub vals []string
}Structure encapsulating keys, vals.
keys []stringvals []stringnewpub fn new(src string) TemplateConstruct a new value of this type.
src stringTemplate — a value of this type
new_dictpub fn new_dict() DictConstruct dict.
No arguments are required.
Dict — a value of this type
($&Dict) setpub fn (d $&Dict) set(k string, v string)Execute set on $&Dict.
d $&DictDict instance used by this call (exclusive borrow).k stringv stringThis call does not return a value.
getpub fn get(d &Dict, k string) stringExecute get.
d &Dictk stringstring — result string
execute_strpub fn execute_str(t &Template, root string) stringApply data to template and render output as string. Throws on failure; handle the error or propagate it to the caller.
t &Templateroot stringstring — result string
executepub fn execute(t &Template, d &Dict) stringApply data context to template and execute rendering. Throws on failure; handle the error or propagate it to the caller.
t &Templated &Dictstring — result string
execute_listpub fn execute_list(t &Template, items []string) stringRender the template with a list of strings as its data context; return one string. Throws on failure; handle the error or propagate it to the caller.
t &Templateitems []stringstring — result string
execute_str_htmlpub fn execute_str_html(t &Template, root string) stringExecute str html. Throws on failure; handle the error or propagate it to the caller.
t &Templateroot stringstring — result string
execute_htmlpub fn execute_html(t &Template, d &Dict) stringExecute html. Throws on failure; handle the error or propagate it to the caller.
t &Templated &Dictstring — result string
execute_list_htmlpub fn execute_list_html(t &Template, items []string) stringExecute list html. Throws on failure; handle the error or propagate it to the caller.
t &Templateitems []stringstring — result string