3 个版本

0.1.2 2022年4月19日
0.1.1 2022年2月15日
0.1.0 2022年2月15日

23#header-parser

Download history • Rust 包仓库 1536/week @ 2024-03-14 • Rust 包仓库 2507/week @ 2024-03-21 • Rust 包仓库 3313/week @ 2024-03-28 • Rust 包仓库 2644/week @ 2024-04-04 • Rust 包仓库 2118/week @ 2024-04-11 • Rust 包仓库 2558/week @ 2024-04-18 • Rust 包仓库 3095/week @ 2024-04-25 • Rust 包仓库 2404/week @ 2024-05-02 • Rust 包仓库 2678/week @ 2024-05-09 • Rust 包仓库 3028/week @ 2024-05-16 • Rust 包仓库 3030/week @ 2024-05-23 • Rust 包仓库 3231/week @ 2024-05-30 • Rust 包仓库 2946/week @ 2024-06-06 • Rust 包仓库 1978/week @ 2024-06-13 • Rust 包仓库 2218/week @ 2024-06-20 • Rust 包仓库 1848/week @ 2024-06-27 • Rust 包仓库

9,663 每月下载量
3 个 crates 中使用 (通过 async_http_range_reader)

MIT/Apache 许可协议

15KB
271

http-content-range

Build Cr   ates.io Documentation

一个用于解码 Content-Range 响应头的微型 Rust 库。

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")
        }
    };
}

无运行时依赖