3 releases
0.1.2 | Apr 19, 2022 |
---|---|
0.1.1 | Feb 15, 2022 |
0.1.0 | Feb 15, 2022 |
#22 in #response-headers
11,041 downloads per month
Used in 3 crates
(via async_http_range_reader)
15KB
271 lines
http-content-range
Tiny Rust lib to decode Content-Range response headers.
extern crate http_content_range;
use http_content_range::ContentRange;
fn main() {
let content_range_str = "bytes 42-69/420";
match ContentRange::parse(content_range_str) {
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
)
}
ContentRange::Unknown => {
println!("Unable to parse")
}
};
}