Crates.io | http-content-range |
lib.rs | http-content-range |
version | |
source | src |
created_at | 2022-02-15 03:23:09.815094+00 |
updated_at | 2024-12-26 22:44:05.662158+00 |
description | HTTP Content Range response header parser |
homepage | |
repository | https://github.com/nyurik/http-content-range |
max_upload_size | |
id | 532510 |
Cargo.toml error: | TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Tiny Rust lib to decode Content-Range response headers.
use http_content_range::ContentRange;
let value = ContentRange::parse("bytes 42-69/420");
match value.expect("Failed to parse Content-Range") {
ContentRange::Bytes(r) => {
println!(
"First_byte={}, last_byte={}, complete_length={}",
r.first_byte, r.last_byte, r.complete_length,
);
}
ContentRange::UnboundBytes(r) => {
println!(
"First_byte={}, last_byte={}, complete_length is unknown",
r.first_byte, r.last_byte
);
}
ContentRange::Unsatisfied(r) => {
println!(
"Unsatisfied response, complete_length={}",
r.complete_length
);
}
};
make
.
Install it with cargo install just
.just
.just test
.The code was inspired by the rust-http-range crate.
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.