pub struct TemplateSetting {
pub language: Option<UnicodeLanguageIdentifier>,
pub format: HumusFormatIdentifier,
}Expand description
Language and format setting for the template
It is added as an extension to the request by the TemplateSettingsLayer.
When using axum you can retrieve it using:
ⓘ
async fn some_handler(
// … other arguments …,
Extension(settings): Extension<TemplateSetting>,
) -> Response {
// TODO
}Fields§
§language: Option<UnicodeLanguageIdentifier>The language to use for the template, None means that no preference could be extracted and that the backend should use the default languge.
format: HumusFormatIdentifierThe format identifier for giving to the templating engine.
Trait Implementations§
Source§impl Clone for TemplateSetting
impl Clone for TemplateSetting
Source§impl Debug for TemplateSetting
impl Debug for TemplateSetting
Source§impl HumusQuerySettings for TemplateSetting
impl HumusQuerySettings for TemplateSetting
Source§fn get_format(&self) -> HumusFormatIdentifier
fn get_format(&self) -> HumusFormatIdentifier
Returns the requested output format.
Source§fn get_preferred_language(&self) -> Option<UnicodeLanguageIdentifier>
fn get_preferred_language(&self) -> Option<UnicodeLanguageIdentifier>
Returns the preferred language for the template
Auto Trait Implementations§
impl Freeze for TemplateSetting
impl RefUnwindSafe for TemplateSetting
impl Send for TemplateSetting
impl Sync for TemplateSetting
impl Unpin for TemplateSetting
impl UnsafeUnpin for TemplateSetting
impl UnwindSafe for TemplateSetting
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
Source§fn convert_into(self) -> T
fn convert_into(self) -> T
Infallibly converts a value of type
Self to a value of type T.Source§impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
Source§impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
Source§type Error = <T as ConvertTryFrom<F>>::Error
type Error = <T as ConvertTryFrom<F>>::Error
The type of an error that can occur during a conversion. Read more
Source§fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
Fallibly converts a value of type
Self to a value of type T.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more