Skip to main content

TemplateConfig

Struct TemplateConfig 

Source
pub struct TemplateConfig {
Show 22 fields pub ffi: TemplateFfi, 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 csp: Option<HttpCsp>, pub cors: Option<HttpCors>, 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>, pub variables: Option<Vec<String>>, pub middlewares: Option<Vec<String>>,
}
Expand description

Template configuration for Ordinary Applications.

Fields§

§ffi: TemplateFfi

Foreign function interface config

§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

§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.

§csp: Option<HttpCsp>

HTTP Content Security Policy configuration.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP

“Base” defaults to default-src 'self'; and tacks on SHA-256 integrity hashes for all inlined scripts and styles (generated at build time) to script-src 'self' sha256-b64 and style-src 'self' sha256-b64, respectively.

https: is used when not running in --insecure mode.

§cors: Option<HttpCors>§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>§variables: Option<Vec<String>>

List of build time environment variables.

format in template: {{ YOUR_VAR }}

§middlewares: Option<Vec<String>>

list of names of middleware to include for this template

Trait Implementations§

Source§

impl Clone for TemplateConfig

Source§

fn clone(&self) -> TemplateConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for TemplateConfig

Source§

impl Debug for TemplateConfig

Source§

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

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

impl Default for TemplateConfig

Source§

fn default() -> TemplateConfig

Returns the “default value” for a type. 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 JsonSchema for TemplateConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. 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
Source§

impl ToSchema for TemplateConfig

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference utoipa::openapi::schema::Schemas for this type. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PartialSchema for T
where T: ComposeSchema + ?Sized,

Source§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more