Function actix_http::header::q
source · [−]Expand description
Convenience function to create a Quality
from an f32
(0.0–1.0).
Not recommended for use with user input. Rely on the TryFrom
impls where possible.
Panics
Panics if value is out of range.
Examples
let q1 = q(1.0);
assert_eq!(q1, Quality::MAX);
let q2 = q(0.0);
assert_eq!(q2, Quality::MIN);
let q3 = q(0.42);
An out-of-range f32
quality will panic.
ⓘ
let _q2 = q(1.42);