pub struct FormatChooser { /* private fields */ }Expand description
Helper that given a TemplatesManifest can read a HumusFormatIdentifier from an HTTP Accept header.
Implementations§
Source§impl FormatChooser
impl FormatChooser
Sourcepub fn new<ApiFormat>(manifest: &TemplatesManifest) -> Selfwhere
ApiFormat: HumusApiFormat,
pub fn new<ApiFormat>(manifest: &TemplatesManifest) -> Selfwhere
ApiFormat: HumusApiFormat,
Create a new format chooser from a parsed manifest and the ApiFormat type.
Sourcepub fn choose_from_accept_header(
&self,
header: &AcceptHeader,
) -> Option<HumusFormatIdentifier>
pub fn choose_from_accept_header( &self, header: &AcceptHeader, ) -> Option<HumusFormatIdentifier>
Returns the best fitting HumusFormatIdentifier for the given header
Sourcepub fn choose_from_user_agent(
&self,
user_agent: &str,
) -> Option<HumusFormatIdentifier>
pub fn choose_from_user_agent( &self, user_agent: &str, ) -> Option<HumusFormatIdentifier>
Returns the best fitting HumusFormatIdentifier for the given user agent
Trait Implementations§
Source§impl Clone for FormatChooser
impl Clone for FormatChooser
Auto Trait Implementations§
impl Freeze for FormatChooser
impl RefUnwindSafe for FormatChooser
impl Send for FormatChooser
impl Sync for FormatChooser
impl Unpin for FormatChooser
impl UnsafeUnpin for FormatChooser
impl UnwindSafe for FormatChooser
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