1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-27 07:19:04 +02:00

add method for getting accept type preference (#1793)

This commit is contained in:
Rob Ede
2020-11-24 10:08:57 +00:00
committed by GitHub
parent 2f11ef089b
commit 70f4747a23
3 changed files with 138 additions and 9 deletions

View File

@ -18,7 +18,7 @@ use self::internal::IntoQuality;
///
/// [RFC7231 Section 5.3.1](https://tools.ietf.org/html/rfc7231#section-5.3.1)
/// gives more information on quality values in HTTP header fields.
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Quality(u16);
impl Default for Quality {
@ -121,7 +121,7 @@ fn from_f32(f: f32) -> Quality {
/// Convenience function to wrap a value in a `QualityItem`
/// Sets `q` to the default 1.0
pub fn qitem<T>(item: T) -> QualityItem<T> {
QualityItem::new(item, Default::default())
QualityItem::new(item, Quality::default())
}
/// Convenience function to create a `Quality` from a float or integer.