1 unstable release
Uses old Rust 2015
0.5.0 | Jan 29, 2017 |
---|
#109 in #http-header
Used in uhttp_json_api
8KB
93 lines
uhttp_transfer_encoding -- Parser for HTTP Transfer-Encoding header
This crate provides a zero-allocation, iterator/slice-based parser for extracting
transfer encoding types as they
appear in the Transfer-Encoding
request header. Standard
encodings
are extracted as enum values, and unknown encodings are extracted as slices for
further processing.
Example
use uhttp_transfer_encoding::{transfer_encodings, TransferEncoding, StdTransferEncoding};
let mut encs = transfer_encodings(" gzip, custom-enc, chunked");
assert_eq!(encs.next(), Some(TransferEncoding::Std(StdTransferEncoding::Chunked)));
assert_eq!(encs.next(), Some(TransferEncoding::Other("custom-enc")));
assert_eq!(encs.next(), Some(TransferEncoding::Std(StdTransferEncoding::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_transfer_encoding = "0.5.0"
and importing it in the crate root:
extern crate uhttp_transfer_encoding;