Struct hyper::header::Quality [-] [+] [src]

pub struct Quality(pub u16);

Represents a quality used in quality values.

Can be created with the q function.

Implementation notes

The quality value is defined as a number between 0 and 1 with three decimal places. This means there are 1000 possible values. Since floating point numbers are not exact and the smallest floating point data type (f32) consumes four bytes, hyper uses an u16 value to store the quality internally. For performance reasons you may set quality directly to a value between 0 and 1000 e.g. Quality(532) matches the quality q=0.532.

Trait Implementations

impl Display for Quality

fn fmt(&self, f: &mut Formatter) -> Result

impl FromPrimitive for Quality

fn from_i64(n: i64) -> Option<Quality>

fn from_u64(n: u64) -> Option<Quality>

fn from_f64(n: f64) -> Option<Quality>

fn from_int(n: isize) -> Option<Self>

fn from_i8(n: i8) -> Option<Self>

fn from_i16(n: i16) -> Option<Self>

fn from_i32(n: i32) -> Option<Self>

fn from_uint(n: usize) -> Option<Self>

fn from_u8(n: u8) -> Option<Self>

fn from_u16(n: u16) -> Option<Self>

fn from_u32(n: u32) -> Option<Self>

fn from_f32(n: f32) -> Option<Self>

impl ToPrimitive for Quality

fn to_i64(&self) -> Option<i64>

fn to_u64(&self) -> Option<u64>

fn to_f64(&self) -> Option<f64>

fn to_int(&self) -> Option<isize>

fn to_i8(&self) -> Option<i8>

fn to_i16(&self) -> Option<i16>

fn to_i32(&self) -> Option<i32>

fn to_uint(&self) -> Option<usize>

fn to_u8(&self) -> Option<u8>

fn to_u16(&self) -> Option<u16>

fn to_u32(&self) -> Option<u32>

fn to_f32(&self) -> Option<f32>

impl Default for Quality

fn default() -> Quality

Derived Implementations

impl PartialOrd for Quality

fn partial_cmp(&self, __arg_0: &Quality) -> Option<Ordering>

fn lt(&self, __arg_0: &Quality) -> bool

fn le(&self, __arg_0: &Quality) -> bool

fn gt(&self, __arg_0: &Quality) -> bool

fn ge(&self, __arg_0: &Quality) -> bool

impl PartialEq for Quality

fn eq(&self, __arg_0: &Quality) -> bool

fn ne(&self, __arg_0: &Quality) -> bool

impl Ord for Quality

fn cmp(&self, __arg_0: &Quality) -> Ordering

impl Eq for Quality

fn assert_receiver_is_total_eq(&self)

impl Debug for Quality

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for Quality

fn clone(&self) -> Quality

fn clone_from(&mut self, source: &Self)