rust2.0 #1
@ -13,3 +13,5 @@ indent_size = 2
|
|||||||
indent_size = 4
|
indent_size = 4
|
||||||
[*.dart]
|
[*.dart]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
[*.rs]
|
||||||
|
indent_size = 4
|
||||||
|
2
templates/Rust2.0/.gitignore
vendored
Normal file
2
templates/Rust2.0/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
target
|
||||||
|
Cargo.lock
|
15
templates/Rust2.0/Cargo.toml
Normal file
15
templates/Rust2.0/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[package]
|
||||||
|
name = "__name__"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
int-enum = "0.5.0"
|
||||||
|
serde = { version = "1.0.147", features = ["derive"] }
|
||||||
|
serde_json = "1.0.88"
|
||||||
|
threadpool = "1.8.1"
|
||||||
|
nanoid = "0.4.0"
|
||||||
|
tokio = { version = "1.22.0", features = ["full"] }
|
||||||
|
|
44
templates/Rust2.0/src/lib.rs
Normal file
44
templates/Rust2.0/src/lib.rs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
use nanoid::nanoid;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use serde_json::Value;
|
||||||
|
use std::boxed::Box;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::marker::PhantomData;
|
||||||
|
use std::marker::Send;
|
||||||
|
use std::sync::mpsc::{Receiver, Sender};
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
use threadpool::ThreadPool;
|
||||||
|
|
||||||
|
pub type Result<T> = std::result::Result<T, Box<dyn Error>>;
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct JRPCRequest {
|
||||||
|
pub jsonrpc: String,
|
||||||
|
pub id: Option<String>,
|
||||||
|
pub method: String,
|
||||||
|
pub params: Value,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct JRPCError {
|
||||||
|
pub code: i64,
|
||||||
|
pub message: String,
|
||||||
|
pub data: Value,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct JRPCResult {
|
||||||
|
pub jsonrpc: String,
|
||||||
|
pub id: String,
|
||||||
|
pub result: Value,
|
||||||
|
pub error: Option<JRPCError>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JRPCServer {}
|
||||||
|
|
||||||
|
impl JRPCServer {
|
||||||
|
fn handle(&self) -> () {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JRPCServerService {}
|
Loading…
Reference in New Issue
Block a user