|
@@ -50,20 +50,20 @@ pub struct JsonNotification {
|
|
|
pub fn request(m: Value, p: Value) -> JsonRequest {
|
|
pub fn request(m: Value, p: Value) -> JsonRequest {
|
|
|
let mut rng = rand::thread_rng();
|
|
let mut rng = rand::thread_rng();
|
|
|
|
|
|
|
|
- return JsonRequest {
|
|
|
|
|
|
|
+ JsonRequest {
|
|
|
jsonrpc: json!("2.0"),
|
|
jsonrpc: json!("2.0"),
|
|
|
method: m,
|
|
method: m,
|
|
|
params: p,
|
|
params: p,
|
|
|
id: json!(rng.gen::<u32>()),
|
|
id: json!(rng.gen::<u32>()),
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn response(r: Value, i: Value) -> JsonResponse {
|
|
pub fn response(r: Value, i: Value) -> JsonResponse {
|
|
|
- return JsonResponse {
|
|
|
|
|
|
|
+ JsonResponse {
|
|
|
jsonrpc: json!("2.0"),
|
|
jsonrpc: json!("2.0"),
|
|
|
result: r,
|
|
result: r,
|
|
|
id: i,
|
|
id: i,
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn error(c: i64, m: String, i: Value) -> JsonError {
|
|
pub fn error(c: i64, m: String, i: Value) -> JsonError {
|
|
@@ -72,17 +72,17 @@ pub fn error(c: i64, m: String, i: Value) -> JsonError {
|
|
|
message: json!(m),
|
|
message: json!(m),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- return JsonError {
|
|
|
|
|
|
|
+ JsonError {
|
|
|
jsonrpc: json!("2.0"),
|
|
jsonrpc: json!("2.0"),
|
|
|
error: ev,
|
|
error: ev,
|
|
|
id: i,
|
|
id: i,
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn notification(m: Value, p: Value) -> JsonNotification {
|
|
pub fn notification(m: Value, p: Value) -> JsonNotification {
|
|
|
- return JsonNotification {
|
|
|
|
|
|
|
+ JsonNotification {
|
|
|
jsonrpc: json!("2.0"),
|
|
jsonrpc: json!("2.0"),
|
|
|
method: m,
|
|
method: m,
|
|
|
params: p,
|
|
params: p,
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|