headers icon indicating copy to clipboard operation
headers copied to clipboard

Document common usage

Open nakedible-p opened this issue 3 years ago • 0 comments

The documentation for the crate does not specify what is the common way to use this crate - it only explains how to extend it for new headers.

It took a bit of trial and error until I finally found the trait HeaderMapExt. And even that trait isn't documented.

The documentation should have something like:

use headers::HeaderMapExt;

let mut headers = HeaderMap::new();
headers.typed_insert(Upgrade::websocket());
let ws = headers.typed_get::<Upgrade>();

nakedible-p avatar Apr 16 '23 09:04 nakedible-p