Skip to main content

Crate turul_rpc

Crate turul_rpc 

Source
Expand description

§turul-rpc

Typed JSON-RPC 2.0 framework. Facade crate re-exporting the turul-rpc-core, turul-rpc-jsonrpc, and turul-rpc-server crates under stable paths that mirror the original turul-mcp-json-rpc-server 0.3.x layout.

Most consumers should depend on this crate. Use the split crates directly only when you need to avoid pulling in the async runtime (depend on turul-rpc-core only) or want to write a transport on top of the codec without the dispatcher (depend on turul-rpc-jsonrpc).

Modules§

async
Async dispatcher and handler trait. Mirrors the original r#async module from turul-mcp-json-rpc-server.
dispatch
JSON-RPC 2.0 codec — parser, batch handling, response helpers.
error
error_codes
Standard JSON-RPC 2.0 error codes.
notification
prelude
Convenient re-exports of the most commonly used types.
request
response
types

Structs§

JsonRpcDispatcher
JSON-RPC method dispatcher with a typed domain-error type.
JsonRpcError
JSON-RPC 2.0 error types and standard error codes. JSON-RPC Error response
JsonRpcNotification
JSON-RPC notification message structure for fire-and-forget communications. A JSON-RPC notification (request without an id)
JsonRpcRequest
JSON-RPC request structure with method and parameters. A JSON-RPC request
JsonRpcSuccessResponse
JSON-RPC response types: the §5 Response object union (JsonRpcResponse) and the success-only struct (JsonRpcSuccessResponse). A successful JSON-RPC response object (JSON-RPC 2.0 §5, success case): {jsonrpc, id, result}.
SessionContext
Minimal session context for JSON-RPC handlers.

Enums§

JsonRpcErrorCode
JSON-RPC 2.0 error types and standard error codes. JSON-RPC error codes
JsonRpcMessage
Incoming message union (request | notification) produced by the parser. Enum representing the inbound JSON-RPC messages a server parses: a request or a notification. Responses are produced, not parsed here, and live in turul_rpc_core::response::JsonRpcResponse.
JsonRpcResponse
JSON-RPC response types: the §5 Response object union (JsonRpcResponse) and the success-only struct (JsonRpcSuccessResponse). A JSON-RPC Response object (JSON-RPC 2.0 §5): success XOR error.
JsonRpcVersion
Core JSON-RPC types for version and request identification. JSON-RPC version
JsonRpcWireMessage
Bidirectional wire-message union (request | notification | response) — the schema’s JSONRPCMessage. Superset of JsonRpcMessage; for clients and peers that read responses. Parse with parse_json_rpc_wire_message. Any single JSON-RPC 2.0 message read off the wire, in either direction.
RequestId
Core JSON-RPC types for version and request identification. A uniquely identifying ID for a JSON-RPC request: a String, a Number, or Null.
RequestParams
JSON-RPC request structure with method and parameters. Parameters for a JSON-RPC request
ResponseResult
JSON-RPC response types: the §5 Response object union (JsonRpcResponse) and the success-only struct (JsonRpcSuccessResponse). Result data for a JSON-RPC response

Constants§

JSONRPC_VERSION
JSON-RPC 2.0 version constant.

Traits§

JsonRpcHandler
Trait for handling JSON-RPC method calls.

Functions§

parse_json_rpc_wire_message
Bidirectional wire-message union (request | notification | response) — the schema’s JSONRPCMessage. Superset of JsonRpcMessage; for clients and peers that read responses. Parse with parse_json_rpc_wire_message. Parse a JSON string into a JsonRpcWireMessage.