Skip to main content

AssetsConfig

Struct AssetsConfig 

Source
pub struct AssetsConfig {
Show 14 fields pub dir_path: Option<String>, pub base_route: String, pub append_index_html: Option<bool>, pub skip_base_route_index_html: Option<bool>, pub append_html_ext: Option<bool>, pub preserve_exif: Option<bool>, pub html_csp: Option<HttpCsp>, pub http: Option<HttpCache>, pub precompression: Option<CompressionAlgorithms>, pub internal_precompression: Option<ArrayVec<CompressionAlgorithm, 4>>, pub minify_css: Option<bool>, pub minify_js: Option<bool>, pub minify_html: Option<bool>, pub internal_cache_control_header_value: Option<String>,
}

Fields§

§dir_path: Option<String>

Relative path to assets directory.

§base_route: String

Note: must start with a / and cannot end with a / unless / is the entire route.

§append_index_html: Option<bool>

whether to add index.html to the base route and the end of routes having a trailing slash or missing an extension.

i.e. https://example.com/static, https://example.com/static/, https://example.com/static/{*path}/ and https://example.com/static/{*path} (with no extension) would return the contents of /static/index.html or /static/{*path}/index.html.

primarily useful when serving a generated static site.

Note: cannot be used with append_index_ext

§skip_base_route_index_html: Option<bool>

whether the {base_route} and {base_route}/ routes should skip returning the index.html at the root of the static dir.

useful when the static dir base_route is set to / but you’d like to have a template use the / route.

§append_html_ext: Option<bool>

whether to append .html to routes that do not include an extension.

i.e. https://example.com/static/about would return the contents of /static/about.html.

primarily useful when serving a generated static site.

Note: cannot be used with append_index_html

§preserve_exif: Option<bool>

will not strip the exif data from images.

Important: only use if you want all metadata (including location data) on your photos.

§html_csp: Option<HttpCsp>

content security policy for HTML assets

§http: Option<HttpCache>

HTTP cache configuration.

TODO: provide a way to pattern match files for which to apply TODO: specific cache controls.

§precompression: Option<CompressionAlgorithms>

Which encodings to use when precompressing assets.

Serving priority is dictated by specified order.

§internal_precompression: Option<ArrayVec<CompressionAlgorithm, 4>>§minify_css: Option<bool>

Determines whether CSS files should be minified, prior to write.

§minify_js: Option<bool>

Determines whether JS files should be minified, prior to write.

§minify_html: Option<bool>

Determines whether HTML files should be minified, prior to write.

§internal_cache_control_header_value: Option<String>

Implementations§

Source§

impl AssetsConfig

Source

pub fn init(&mut self, default_cache_control_header_value: &str) -> Result<()>

Trait Implementations§

Source§

impl Clone for AssetsConfig

Source§

fn clone(&self) -> AssetsConfig

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 AssetsConfig

Source§

impl Debug for AssetsConfig

Source§

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

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

impl Default for AssetsConfig

Source§

fn default() -> AssetsConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AssetsConfig

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 AssetsConfig

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 AssetsConfig

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

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