17 unstable releases (6 breaking)

0.7.1 Jul 2, 2024
0.7.0 Mar 25, 2024
0.6.1 Jan 6, 2024
0.5.1 Apr 27, 2023
0.2.1 Jul 28, 2022

#1132 in Network programming

Download history 431/week @ 2024-04-04 276/week @ 2024-04-11 397/week @ 2024-04-18 256/week @ 2024-04-25 243/week @ 2024-05-02 145/week @ 2024-05-09 176/week @ 2024-05-16 182/week @ 2024-05-23 220/week @ 2024-05-30 160/week @ 2024-06-06 306/week @ 2024-06-13 373/week @ 2024-06-20 436/week @ 2024-06-27 541/week @ 2024-07-04 348/week @ 2024-07-11 174/week @ 2024-07-18

1,548 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
~153K SLoC