Skip to content
This repository has been archived by the owner on Nov 25, 2019. It is now read-only.

kchmck/uhttp_transfer_encoding.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uhttp_transfer_encoding -- Parser for HTTP Transfer-Encoding header

Documentation

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;

About

Parser for HTTP Transfer-Encoding header in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages