17 个不稳定版本 (6 个重大更改)

0.7.1 2024年7月2日
0.7.0 2024年3月25日
0.6.1 2024年1月6日
0.5.1 2023年4月27日
0.2.1 2022年7月28日

#1103 in 网页编程

Download history • Rust 包仓库 240/week @ 2024-05-01 • Rust 包仓库 129/week @ 2024-05-08 • Rust 包仓库 194/week @ 2024-05-15 • Rust 包仓库 169/week @ 2024-05-22 • Rust 包仓库 236/week @ 2024-05-29 • Rust 包仓库 165/week @ 2024-06-05 • Rust 包仓库 238/week @ 2024-06-12 • Rust 包仓库 416/week @ 2024-06-19 • Rust 包仓库 311/week @ 2024-06-26 • Rust 包仓库 612/week @ 2024-07-03 • Rust 包仓库 385/week @ 2024-07-10 • Rust 包仓库 289/week @ 2024-07-17 • Rust 包仓库 505/week @ 2024-07-24 • Rust 包仓库 473/week @ 2024-07-31 • Rust 包仓库 425/week @ 2024-08-07 • Rust 包仓库 280/week @ 2024-08-14 • Rust 包仓库

1,768 每月下载次数

MIT 许可证

25KB
604

axum 的 Json RPC 提取器

JsonRpcExtractor 解析 JSON-RPC 请求并验证其正确性。

use axum_jrpc::{JrpcResult, JsonRpcExtractor, JsonRpcResponse};

fn router(req: JsonRpcExtractor) -> JrpcResult {
    let req_id = req.get_answer_id()?;
    let method = req.method();
    let response =
        match method {
            "add" => {
                let params: [i32; 2] = req.parse_params()?;
                JsonRpcResponse::success(req_id, params[0] + params[1]);
            }
            m => req.method_not_found(m)
        };

    Ok(response)
}

Crates.io Documentation

依赖项

~5.5–8.5MB
~152K SLoC