Skip to main content

handle_request

Function handle_request 

Source
pub fn handle_request(line: &str) -> Option<JsonRpcResponse>
Expand description

Handle a single JSON-RPC request line.

§Request Processing

  1. Parse JSON-RPC 2.0 request from the line
  2. Validate jsonrpc field is "2.0"
  3. Dispatch to appropriate handler based on method
  4. Return response or None for notifications

§Error Handling

  • Parse Error (-32700): JSON is invalid or malformed
  • Invalid Version (-32600): jsonrpc field is not "2.0"
  • Server Error (-32603): Handler function returns Err
  • No Response: Notifications (requests without id) are handled silently

§Returns

  • Some(response): For requests (with id)
  • None: For notifications (without id)