1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Transport abstraction for JSON-RPC clients.
//!
//! Why: `trpc` needs to talk to both subprocess-style MCP servers (stdin/stdout
//! framed JSON) and HTTP JSON-RPC endpoints with a single client implementation.
//! What: Defines a single `Transport` trait with one `send` method; concrete
//! implementations own their own connection lifecycle.
//! Test: covered indirectly through `RpcClient` unit tests and integration tests.
use Result;
use Value;
pub use HttpTransport;
pub use StdioTransport;
/// Abstract send-one-JSON-RPC-request channel.
///
/// Why: hides stdio-subprocess vs HTTP behind a uniform async surface so
/// `RpcClient` is transport-agnostic.
/// What: a single `send` method that takes a fully-formed JSON-RPC `Value`
/// and returns the response `Value`. For notifications (no `id`), implementations
/// should write the message and return `Value::Null` without blocking on a reply.
/// Test: exercised through client.rs and the integration tests under `tests/`.
/// Helper: a request is a notification if it has no `id` field.
pub