Crate uhttp_content_encoding [] [src]

This crate provides a zero-allocation, iterator/slice-based parser for extracting HTTP content encoding types as they appear in the Content-Encoding request header. Standard encodings are extracted as enum values, and unknown encodings are extracted as slices for further processing.

Example

use uhttp_content_encoding::{content_encodings, ContentEncoding, StdContentEncoding};

let mut encs = content_encodings(" gzip, identity, custom-enc");
assert_eq!(encs.next(), Some(ContentEncoding::Other("custom-enc")));
assert_eq!(encs.next(), Some(ContentEncoding::Std(StdContentEncoding::Identity)));
assert_eq!(encs.next(), Some(ContentEncoding::Std(StdContentEncoding::Gzip)));
assert_eq!(encs.next(), None);

Enums

ContentEncoding

HTTP content encoding scheme.

StdContentEncoding

Standard content encoding scheme, as defined by IANA.

Functions

content_encodings

Create an iterator over content encoding layers from the given string in the form used by the Content-Encoding header field.