Skip to main content

best_encoding

Function best_encoding 

Source
pub fn best_encoding(
    accept_encoding: Option<&[u8]>,
    offers: &[&str],
) -> Option<usize>
Expand description

Selects the best content coding for Accept-Encoding.

ยงExamples

use parse_net::best_encoding;

assert_eq!(best_encoding(Some(b"gzip;q=1.0, identity; q=0.5, *;q=0"), &["br", "identity"]), Some(1));
assert_eq!(best_encoding(Some(b""), &["gzip", "identity"]), Some(1));