Skip to main content

TemplateConfig

Struct TemplateConfig 

Source
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: u8

Unique index for template.

§name: String

Template’s name.

§mime: String

Used 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: String

The 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

Source§

fn clone(&self) -> TemplateConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TemplateConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TemplateConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TemplateConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,