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
Source§fn clone(&self) -> FormatChooser
fn clone(&self) -> FormatChooser
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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