pub enum RawJsonRpcMessage {
Request(RawJsonRpcRequest),
Notification(RawJsonRpcNotification),
Response(RawJsonRpcResponse),
}Expand description
One valid JSON-RPC message carried inside a TransportFrame.
Raw messages are the same for every ACP protocol version: IDs are
RawJsonRpcIds, and method params and response errors are not
interpreted at the transport boundary.
Serializing adds the "jsonrpc": "2.0" member, and deserializing requires
it. Requests and notifications keep only id, method and params:
other members of the envelope are dropped. Error responses keep unknown
members of the error object in RawJsonRpcError::extra.
Variants§
Request(RawJsonRpcRequest)
A JSON-RPC request with an id and expected response.
Notification(RawJsonRpcNotification)
A JSON-RPC notification without a response.
Response(RawJsonRpcResponse)
A JSON-RPC response to a prior request.
Implementations§
Source§impl RawJsonRpcMessage
impl RawJsonRpcMessage
Sourcepub fn request(
method: String,
params: Value,
id: impl Into<RawJsonRpcId>,
) -> Result<Self, Error>
pub fn request( method: String, params: Value, id: impl Into<RawJsonRpcId>, ) -> Result<Self, Error>
Build a raw JSON-RPC request message.
Sourcepub fn notification(method: String, params: Value) -> Result<Self, Error>
pub fn notification(method: String, params: Value) -> Result<Self, Error>
Build a raw JSON-RPC notification message.
Sourcepub fn response(
id: impl Into<RawJsonRpcId>,
response: Result<Value, Error>,
) -> Self
pub fn response( id: impl Into<RawJsonRpcId>, response: Result<Value, Error>, ) -> Self
Build a JSON-RPC response from an ACP result.
For other protocols, construct RawJsonRpcResponse directly so error
codes and fields are not interpreted as ACP.
Sourcepub fn response_id(&self) -> Option<&RawJsonRpcId>
pub fn response_id(&self) -> Option<&RawJsonRpcId>
The response id, if this is a response.
Trait Implementations§
Source§impl Clone for RawJsonRpcMessage
impl Clone for RawJsonRpcMessage
Source§impl Debug for RawJsonRpcMessage
impl Debug for RawJsonRpcMessage
Source§impl<'de> Deserialize<'de> for RawJsonRpcMessage
impl<'de> Deserialize<'de> for RawJsonRpcMessage
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for RawJsonRpcMessage
Source§impl From<RawJsonRpcNotification> for RawJsonRpcMessage
impl From<RawJsonRpcNotification> for RawJsonRpcMessage
Source§fn from(notification: RawJsonRpcNotification) -> Self
fn from(notification: RawJsonRpcNotification) -> Self
Source§impl From<RawJsonRpcRequest> for RawJsonRpcMessage
impl From<RawJsonRpcRequest> for RawJsonRpcMessage
Source§fn from(request: RawJsonRpcRequest) -> Self
fn from(request: RawJsonRpcRequest) -> Self
Source§impl From<RawJsonRpcResponse> for RawJsonRpcMessage
impl From<RawJsonRpcResponse> for RawJsonRpcMessage
Source§fn from(response: RawJsonRpcResponse) -> Self
fn from(response: RawJsonRpcResponse) -> Self
Source§impl PartialEq for RawJsonRpcMessage
impl PartialEq for RawJsonRpcMessage
Source§impl Serialize for RawJsonRpcMessage
impl Serialize for RawJsonRpcMessage
impl StructuralPartialEq for RawJsonRpcMessage
Auto Trait Implementations§
impl Freeze for RawJsonRpcMessage
impl RefUnwindSafe for RawJsonRpcMessage
impl Send for RawJsonRpcMessage
impl Sync for RawJsonRpcMessage
impl Unpin for RawJsonRpcMessage
impl UnsafeUnpin for RawJsonRpcMessage
impl UnwindSafe for RawJsonRpcMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.