pub struct JsonRpcLineEndpoint { /* private fields */ }Expand description
Protocol json rpc line endpoint value used by toolkit JSON-RPC adapters. Constructing the value prepares protocol data; endpoint and transport methods own transcript or I/O effects.
Implementations§
Source§impl JsonRpcLineEndpoint
impl JsonRpcLineEndpoint
Sourcepub fn pair(
left_name: impl Into<String>,
right_name: impl Into<String>,
) -> (Self, Self)
pub fn pair( left_name: impl Into<String>, right_name: impl Into<String>, ) -> (Self, Self)
Builds the pair value. This is data construction and performs no I/O, journal append, event publication, or process work.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the name currently held by this value. This reads endpoint metadata or a queued response from the in-memory transport.
Sourcepub fn send_frame(&self, frame: JsonRpcFrame) -> Result<String, AgentError>
pub fn send_frame(&self, frame: JsonRpcFrame) -> Result<String, AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn send_raw_line(&self, line: impl Into<String>) -> Result<(), AgentError>
pub fn send_raw_line(&self, line: impl Into<String>) -> Result<(), AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn try_receive_raw_line(&self) -> Result<Option<String>, AgentError>
pub fn try_receive_raw_line(&self) -> Result<Option<String>, AgentError>
Reads a JSON-RPC line or frame from the in-memory endpoint queue. It does not perform OS-level I/O.
Sourcepub fn try_receive_frame(&self) -> Result<Option<JsonRpcFrame>, AgentError>
pub fn try_receive_frame(&self) -> Result<Option<JsonRpcFrame>, AgentError>
Reads a JSON-RPC line or frame from the in-memory endpoint queue. It does not perform OS-level I/O.
Sourcepub fn receive_frame(&self) -> Result<JsonRpcFrame, AgentError>
pub fn receive_frame(&self) -> Result<JsonRpcFrame, AgentError>
Reads a JSON-RPC line or frame from the in-memory endpoint queue. It does not perform OS-level I/O.
Sourcepub fn send_request(
&self,
id: impl Into<JsonRpcId>,
method: impl Into<String>,
params: Value,
) -> Result<String, AgentError>
pub fn send_request( &self, id: impl Into<JsonRpcId>, method: impl Into<String>, params: Value, ) -> Result<String, AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn send_notification(
&self,
method: impl Into<String>,
params: Value,
) -> Result<String, AgentError>
pub fn send_notification( &self, method: impl Into<String>, params: Value, ) -> Result<String, AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn send_result(
&self,
id: JsonRpcId,
result: Value,
) -> Result<String, AgentError>
pub fn send_result( &self, id: JsonRpcId, result: Value, ) -> Result<String, AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn send_error(
&self,
id: Option<JsonRpcId>,
code: i64,
message: impl Into<String>,
) -> Result<String, AgentError>
pub fn send_error( &self, id: Option<JsonRpcId>, code: i64, message: impl Into<String>, ) -> Result<String, AgentError>
Queues a JSON-RPC frame on the paired in-memory endpoint and records transcript state for tests; it performs no OS-level I/O.
Sourcepub fn response(&self) -> Result<JsonRpcResponse, AgentError>
pub fn response(&self) -> Result<JsonRpcResponse, AgentError>
Returns the response currently held by this value. This reads endpoint metadata or a queued response from the in-memory transport.
Sourcepub fn notification(&self) -> Result<JsonRpcNotification, AgentError>
pub fn notification(&self) -> Result<JsonRpcNotification, AgentError>
Returns notification for this protocol::line_transport value without performing external I/O.
Sourcepub fn sent_lines(&self) -> Vec<String>
pub fn sent_lines(&self) -> Vec<String>
Returns sent lines for this protocol::line_transport value without performing external I/O. Panics only if the in-memory test transcript lock is poisoned.
Sourcepub fn received_lines(&self) -> Vec<String>
pub fn received_lines(&self) -> Vec<String>
Returns received lines for this protocol::line_transport value without performing external I/O. Panics only if the in-memory test transcript lock is poisoned.
Trait Implementations§
Source§impl Clone for JsonRpcLineEndpoint
impl Clone for JsonRpcLineEndpoint
Source§fn clone(&self) -> JsonRpcLineEndpoint
fn clone(&self) -> JsonRpcLineEndpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more