#[non_exhaustive]pub struct TemplateConfig {
pub templates_path: String,
pub static_path: String,
pub static_url_prefix: String,
pub locales_path: String,
pub default_locale: String,
pub locale_cookie: String,
pub locale_query_param: String,
}Expand description
Configuration for the template engine.
All fields have sensible defaults and can be overridden via YAML config. Paths are relative to the working directory of the running process.
§Defaults
| Field | Default |
|---|---|
templates_path | "templates" |
static_path | "static" |
static_url_prefix | "/assets" |
locales_path | "locales" |
default_locale | "en" |
locale_cookie | "lang" |
locale_query_param | "lang" |
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.templates_path: StringDirectory that contains MiniJinja template files.
static_path: StringDirectory that contains static assets (CSS, JS, images, etc.).
static_url_prefix: StringURL prefix under which static assets are served (e.g. "/assets").
locales_path: StringDirectory that contains locale subdirectories with YAML translation files.
default_locale: StringBCP 47 language tag used when no locale can be resolved from the request.
Cookie name read by CookieResolver to determine the active locale.
locale_query_param: StringQuery-string parameter name read by QueryParamResolver.
Trait Implementations§
Source§impl Clone for TemplateConfig
impl Clone for TemplateConfig
Source§fn clone(&self) -> TemplateConfig
fn clone(&self) -> TemplateConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TemplateConfig
impl Debug for TemplateConfig
Source§impl Default for TemplateConfig
impl Default for TemplateConfig
Source§impl<'de> Deserialize<'de> for TemplateConfigwhere
TemplateConfig: Default,
impl<'de> Deserialize<'de> for TemplateConfigwhere
TemplateConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TemplateConfig
impl RefUnwindSafe for TemplateConfig
impl Send for TemplateConfig
impl Sync for TemplateConfig
impl Unpin for TemplateConfig
impl UnsafeUnpin for TemplateConfig
impl UnwindSafe for TemplateConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more