16 unstable releases (6 breaking)

0.7.0 Mar 25, 2024
0.5.2 Jan 6, 2024
0.5.1 Apr 27, 2023
0.4.0 Feb 15, 2023
0.2.1 Jul 28, 2022

#1113 in Network programming

Download history 199/week @ 2024-02-14 286/week @ 2024-02-21 210/week @ 2024-02-28 477/week @ 2024-03-06 394/week @ 2024-03-13 382/week @ 2024-03-20 342/week @ 2024-03-27 444/week @ 2024-04-03 279/week @ 2024-04-10 422/week @ 2024-04-17 260/week @ 2024-04-24 240/week @ 2024-05-01 129/week @ 2024-05-08 194/week @ 2024-05-15 169/week @ 2024-05-22 198/week @ 2024-05-29

731 downloads per month

MIT license

25KB
604 lines

Json RPC extractor for axum

JsonRpcExtractor parses JSON-RPC requests and validates it's correctness.

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

Dependencies

~5.5–8.5MB
~154K SLoC