#etag #if-match #if-none-match

no-std entity-tag

This crate provides a EntityTag structure and functions to deal with the ETag header field of HTTP

5 releases

0.1.5 Apr 26, 2021
0.1.4 Apr 25, 2021

#6 in #etag

Download history 236/week @ 2021-08-11 7/week @ 2021-08-18 14/week @ 2021-08-25 4/week @ 2021-09-01 66/week @ 2021-09-08 61/week @ 2021-09-15 40/week @ 2021-09-22 30/week @ 2021-09-29 19/week @ 2021-10-06 50/week @ 2021-10-13 37/week @ 2021-10-20 136/week @ 2021-10-27 79/week @ 2021-11-03 71/week @ 2021-11-10 30/week @ 2021-11-17 23/week @ 2021-11-24

208 downloads per month
Used in 9 crates (via rocket-etag-if-none-match)

MIT license

13KB
272 lines

Entity Tag

CI

This crate provides a EntityTag structure and functions to deal with the ETag header field of HTTP.

Examples

extern crate entity_tag;

use entity_tag::EntityTag;

let etag1 = EntityTag::with_str(true, "foo").unwrap();
let etag2 = EntityTag::from_str("\"foo\"").unwrap();

assert_eq!(true, etag1.weak);
assert_eq!(false, etag2.weak);

assert!(etag1.weak_eq(&etag2));
assert!(etag1.strong_ne(&etag2));

let etag3 = EntityTag::from_data(true, &[102, 111, 111]).unwrap();
assert_eq!("W/\"j4VF2Hjg0No\"", etag3.to_string());

let etag4 = EntityTag::from_file_meta(&std::fs::File::open("tests/data/P1060382.JPG").unwrap().metadata().unwrap());
println!("{}", etag4) // W/"CmgjkoKAfwQ"

No Std

Disable the default features to compile this crate without std.

[dependencies.entity-tag]
version = "*"
default-features = false

Crates.io

https://crates.io/crates/entity-tag

Documentation

https://docs.rs/entity-tag

License

MIT

Dependencies

~255KB

`