2 releases
Uses old Rust 2015
0.5.1 | Jan 29, 2017 |
---|---|
0.5.0 | Jan 29, 2017 |
#108 in #http-header
Used in uhttp_json_api
9KB
115 lines
uhttp_content_encoding -- Parser for HTTP Content-Encoding header
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);
Usage
This crate can be used through cargo by
adding it as a dependency in Cargo.toml
:
[dependencies]
uhttp_content_encoding = "0.5.1"
and importing it in the crate root:
extern crate uhttp_content_encoding;