Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magiclen/entity-tag
This crate provides a `EntityTag` structure and functions to deal with the ETag header field of HTTP.
https://github.com/magiclen/entity-tag
etag rust
Last synced: 28 days ago
JSON representation
This crate provides a `EntityTag` structure and functions to deal with the ETag header field of HTTP.
- Host: GitHub
- URL: https://github.com/magiclen/entity-tag
- Owner: magiclen
- License: mit
- Created: 2021-04-20T14:07:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-11T05:00:08.000Z (over 1 year ago)
- Last Synced: 2024-11-17T05:39:14.323Z (about 1 month ago)
- Topics: etag, rust
- Language: Rust
- Homepage:
- Size: 6.14 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Entity Tag
====================[![CI](https://github.com/magiclen/entity-tag/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/entity-tag/actions/workflows/ci.yml)
This crate provides a `EntityTag` structure and functions to deal with the ETag header field of HTTP.
## Examples
```rust
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/\"972Sf7Z4eu8\"", etag3.to_string());let etag4 = EntityTag::from_file_meta(&std::fs::File::open("tests/data/P1060382.JPG").unwrap().metadata().unwrap());
println!("{}", etag4) // W/"HRScBWR0Mf4"
```## No Std
Disable the default features to compile this crate without std.
```toml
[dependencies.entity-tag]
version = "*"
default-features = false
```## Crates.io
https://crates.io/crates/entity-tag
## Documentation
https://docs.rs/entity-tag
## License
[MIT](LICENSE)