turul_rpc_jsonrpc/lib.rs
1//! # turul-rpc-jsonrpc
2//!
3//! JSON-RPC 2.0 codec and parser for `turul-rpc`. Provides incoming-message
4//! parsing, batch processing, and response helper constructors.
5//!
6//! Most consumers should depend on the [`turul-rpc`] facade rather than this
7//! crate directly.
8//!
9//! [`turul-rpc`]: https://crates.io/crates/turul-rpc
10//!
11//! ## JSON-RPC 2.0 batch support
12//!
13//! Per [JSON-RPC 2.0 ยง6][spec-batch], a request body may be an array of
14//! request objects. This crate implements batch parsing via
15//! [`parse_json_rpc_batch`] and surfaces the result as [`BatchOrSingle`].
16//! The dispatcher in `turul-rpc-server` consumes this and runs the
17//! per-member handlers, suppressing notification responses per spec.
18//!
19//! [spec-batch]: https://www.jsonrpc.org/specification#batch
20
21pub mod batch;
22pub mod dispatch;
23pub mod frame;
24
25// Re-export the dispatch module's public items at the crate root for
26// ergonomic access. The `batch` module is intentionally kept as a separate
27// module path (not re-exported here) so that the
28// `turul-mcp-json-rpc-server 0.3.39` shim does not surface the new batch
29// APIs through the v0.3.38 dispatch path. See ADR-003.
30pub use batch::{BatchOrSingle, parse_json_rpc_batch};
31pub use dispatch::{
32 JsonRpcMessage, JsonRpcMessageResult, create_error_response, create_success_response,
33 parse_json_rpc_message, parse_json_rpc_messages,
34};