pub struct AcceptEncoding {
pub encodings: Vec<(Encoding, f32)>,
}Expand description
Represents a parsed Accept-Encoding header.
Fields§
§encodings: Vec<(Encoding, f32)>Encodings with their quality values, sorted by preference.
Implementations§
Source§impl AcceptEncoding
impl AcceptEncoding
Sourcepub fn parse(header: &str) -> Self
pub fn parse(header: &str) -> Self
Parse an Accept-Encoding header string.
§Example
use armature_core::content_negotiation::AcceptEncoding;
let accept = AcceptEncoding::parse("gzip, deflate, br;q=0.9");
assert_eq!(accept.encodings.len(), 3);Sourcepub fn quality_for(&self, encoding: Encoding) -> f32
pub fn quality_for(&self, encoding: Encoding) -> f32
Get the quality value for a specific encoding.
Trait Implementations§
Source§impl Clone for AcceptEncoding
impl Clone for AcceptEncoding
Source§fn clone(&self) -> AcceptEncoding
fn clone(&self) -> AcceptEncoding
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 moreSource§impl Debug for AcceptEncoding
impl Debug for AcceptEncoding
Source§impl Default for AcceptEncoding
impl Default for AcceptEncoding
Source§fn default() -> AcceptEncoding
fn default() -> AcceptEncoding
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AcceptEncoding
impl RefUnwindSafe for AcceptEncoding
impl Send for AcceptEncoding
impl Sync for AcceptEncoding
impl Unpin for AcceptEncoding
impl UnsafeUnpin for AcceptEncoding
impl UnwindSafe for AcceptEncoding
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<R, D> DepsPresent<D> for R
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging