[][src]Crate accept_encoding_fork

Examples

use accept_encoding::Encoding;
use http::header::{HeaderMap, HeaderValue, ACCEPT_ENCODING};

let mut headers = HeaderMap::new();
headers.insert(ACCEPT_ENCODING, HeaderValue::from_str("gzip, deflate, br")?);

let encoding = accept_encoding::parse(&headers)?;
assert_eq!(encoding, Some(Encoding::Gzip));
use accept_encoding::Encoding;
use http::header::{HeaderMap, HeaderValue, ACCEPT_ENCODING};

let mut headers = HeaderMap::new();
headers.insert(ACCEPT_ENCODING, HeaderValue::from_str("gzip;q=0.5, deflate;q=0.9, br;q=1.0")?);

let encoding = accept_encoding::parse(&headers)?;
assert_eq!(encoding, Some(Encoding::Brotli));

Structs

Error

A specialized Error type for this crate's operations.

Enums

Encoding

Encodings to use.

ErrorKind

A list enumerating the categories of errors in this crate.

Functions

encodings

Parse a set of HTTP headers into a vector containing tuples of options containing encodings and their corresponding q-values.

parse

Parse a set of HTTP headers into a single option yielding an Encoding that the client prefers.

Type Definitions

Result

A specialized Result type for this crate's operations.