pub struct JsonRpcResponse {
pub jsonrpc: String,
pub id: Option<JsonRpcId>,
pub result: Option<Value>,
pub error: Option<JsonRpcError>,
}Expand description
JSON-RPC 2.0 response message
Represents an outgoing response to the LSP client.
Either result or error should be set, but not both.
Fields§
§jsonrpc: StringJSON-RPC version (always “2.0”)
id: Option<JsonRpcId>Request identifier (matches the request’s id)
result: Option<Value>Success result (mutually exclusive with error)
error: Option<JsonRpcError>Error result (mutually exclusive with result)
Implementations§
Source§impl JsonRpcResponse
impl JsonRpcResponse
Sourcepub fn success(id: Option<JsonRpcId>, result: Value) -> JsonRpcResponse
pub fn success(id: Option<JsonRpcId>, result: Value) -> JsonRpcResponse
Create a success response
Sourcepub fn error(id: Option<JsonRpcId>, error: JsonRpcError) -> JsonRpcResponse
pub fn error(id: Option<JsonRpcId>, error: JsonRpcError) -> JsonRpcResponse
Create an error response
Sourcepub fn null(id: Option<JsonRpcId>) -> JsonRpcResponse
pub fn null(id: Option<JsonRpcId>) -> JsonRpcResponse
Create a null result response (for methods that return nothing)
Trait Implementations§
Source§impl Debug for JsonRpcResponse
impl Debug for JsonRpcResponse
Source§impl Serialize for JsonRpcResponse
impl Serialize for JsonRpcResponse
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for JsonRpcResponse
impl RefUnwindSafe for JsonRpcResponse
impl Send for JsonRpcResponse
impl Sync for JsonRpcResponse
impl Unpin for JsonRpcResponse
impl UnsafeUnpin for JsonRpcResponse
impl UnwindSafe for JsonRpcResponse
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