pub enum JsonRpcFrame {
Request(JsonRpcRequest),
Response(JsonRpcResponse),
Notification(JsonRpcNotification),
}Expand description
Parsed JSON-RPC frame used by line transports and scripted protocol fakes. Matching on the frame is side-effect free; endpoint methods own any transcript or transport mutation.
Variants§
Request(JsonRpcRequest)
Client request that expects a response.
Response(JsonRpcResponse)
Response to a previously sent request.
Notification(JsonRpcNotification)
One-way notification with no response id.
Implementations§
Source§impl JsonRpcFrame
impl JsonRpcFrame
Sourcepub fn to_line(&self) -> Result<String, AgentError>
pub fn to_line(&self) -> Result<String, AgentError>
Converts this value into line data. This serializes the frame into one JSON-RPC line and performs no transport I/O.
Sourcepub fn from_line(line: &str) -> Result<Self, AgentError>
pub fn from_line(line: &str) -> Result<Self, AgentError>
Constructs this value from line. Use it when adapting canonical SDK records without introducing a second behavior path.
Trait Implementations§
Source§impl Clone for JsonRpcFrame
impl Clone for JsonRpcFrame
Source§fn clone(&self) -> JsonRpcFrame
fn clone(&self) -> JsonRpcFrame
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonRpcFrame
impl Debug for JsonRpcFrame
Source§impl PartialEq for JsonRpcFrame
impl PartialEq for JsonRpcFrame
Source§fn eq(&self, other: &JsonRpcFrame) -> bool
fn eq(&self, other: &JsonRpcFrame) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for JsonRpcFrame
Auto Trait Implementations§
impl Freeze for JsonRpcFrame
impl RefUnwindSafe for JsonRpcFrame
impl Send for JsonRpcFrame
impl Sync for JsonRpcFrame
impl Unpin for JsonRpcFrame
impl UnsafeUnpin for JsonRpcFrame
impl UnwindSafe for JsonRpcFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more