pub struct TemplateConfig {Show 17 fields
pub idx: u8,
pub name: String,
pub mime: String,
pub minify: Option<bool>,
pub path: Option<String>,
pub route: String,
pub protected: Option<Check>,
pub cache: Option<TemplateCache>,
pub timeout: Option<u16>,
pub fields: Option<Vec<TemplateField>>,
pub globals: Option<Vec<String>>,
pub flags: Option<Vec<TemplateFlagRef>>,
pub params: Option<Vec<TemplateParamRef>>,
pub models: Option<Vec<TemplateRef>>,
pub content: Option<Vec<TemplateRef>>,
pub actions: Option<Vec<String>>,
pub wasm_opt: Option<WasmOpt>,
}Expand description
Template configuration for Ordinary Applications.
Fields§
§idx: u8Unique index for template.
name: StringTemplate’s name.
mime: StringUsed as the content-type header for HTTP responses.
Validated against file extension (if path is present).
minify: Option<bool>Specifies whether the content in the file should be “minified”/have whitespace removed.
path: Option<String>Relative path to the template file
route: StringThe route used in the HTTP server to serve this template. Can use segments to bind to properties on models or content definitions:
{
...
"route": "/posts/{slug}",
...
"models": [
{
"name": "post",
"fields": [
{ "name": "slug", "bind": { "Segment": { "name": "slug" } } },
]
}
]
}protected: Option<Check>What to check the token fields against. If left blank, route is considered public.
cache: Option<TemplateCache>Used to specify the cache policy for this template.
timeout: Option<u16>Max duration for the template.
Unit: seconds
fields: Option<Vec<TemplateField>>Used for template-specific variables that don’t need to be shared beyond the scope of the given template, and don’t warrant a content object.
globals: Option<Vec<String>>List of global variables to be included with the compiled template binary. Globals are excluded by default and have to be explicitly listed in the globals to be accessed from the template.
flags: Option<Vec<TemplateFlagRef>>List of flags to be referenced by the template.
params: Option<Vec<TemplateParamRef>>List of params to be referenced by the template.
models: Option<Vec<TemplateRef>>List of models and what fields the template needs from the models. This is effectively a query definition.
content: Option<Vec<TemplateRef>>List of content definitions and the content definition fields that this template will use.
actions: Option<Vec<String>>Specifies which actions this template triggers, and adds this template’s route pattern to the action’s list of valid origins.
wasm_opt: Option<WasmOpt>Trait Implementations§
Source§impl Clone for TemplateConfig
impl Clone for TemplateConfig
Source§fn clone(&self) -> TemplateConfig
fn clone(&self) -> TemplateConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more