Răsfoiți Sursa

salvo version 0.27 (#7492)

Chrislearn Young 3 ani în urmă
părinte
comite
1782a199f2

+ 2 - 2
frameworks/Rust/salvo/Cargo.toml

@@ -22,11 +22,11 @@ bytes = "1.1.0"
 diesel = { version = "1.4", features = ["postgres", "r2d2"] }
 futures = "0.3"
 markup = "0.13.0"
-mimalloc = { version = "0.1.25", default-features = false }
+# mimalloc = { version = "0.1.25", default-features = false }
 once_cell = "1.5.2"
 rand = { version = "0.8.3", features = ["min_const_gen", "small_rng"] }
 random-fast-rng = "0.1.1"
-salvo = { version = "0.26", features = ["anyhow"] }
+salvo = { version = "0.27", features = ["anyhow"] }
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0.81"
 smallvec = "1.6.1"

+ 1 - 1
frameworks/Rust/salvo/salvo-diesel.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.61.0
+FROM rust:1.62.1
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++
 

+ 1 - 1
frameworks/Rust/salvo/salvo-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.61.0
+FROM rust:1.62.1
 
 RUN apt-get update -yqq && apt-get install -yqq cmake g++
 

+ 1 - 1
frameworks/Rust/salvo/salvo.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.61.0
+FROM rust:1.62.1
 
 # Disable simd at jsonescape
 ENV CARGO_CFG_JSONESCAPE_DISABLE_AUTO_SIMD=

+ 4 - 4
frameworks/Rust/salvo/src/main.rs

@@ -1,5 +1,5 @@
-#[global_allocator]
-static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+// #[global_allocator]
+// static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
 use std::sync::Arc;
 use std::thread::available_parallelism;
@@ -18,7 +18,7 @@ pub struct Message {
     pub message: &'static str,
 }
 
-#[fn_handler]
+#[handler]
 fn json(res: &mut Response) {
     let headers = res.headers_mut();
     headers.insert(header::SERVER, HeaderValue::from_static("S"));
@@ -30,7 +30,7 @@ fn json(res: &mut Response) {
     res.set_body(Body::Once(Bytes::from(data)));
 }
 
-#[fn_handler]
+#[handler]
 fn plaintext(res: &mut Response) {
     let headers = res.headers_mut();
     headers.insert(header::SERVER, HeaderValue::from_static("S"));

+ 5 - 5
frameworks/Rust/salvo/src/main_diesel.rs

@@ -46,7 +46,7 @@ fn build_pool(database_url: &str, size: u32) -> Result<PgPool, PoolError> {
         .build(manager)
 }
 
-#[fn_handler]
+#[handler]
 async fn world_row(res: &mut Response) -> Result<(), Error> {
     let mut rng = SmallRng::from_entropy();
     let random_id = rng.gen_range(1..10_001);
@@ -57,7 +57,7 @@ async fn world_row(res: &mut Response) -> Result<(), Error> {
     Ok(())
 }
 
-#[fn_handler]
+#[handler]
 async fn queries(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     let count = req.query::<usize>("q").unwrap_or(1);
     let count = cmp::min(500, cmp::max(1, count));
@@ -74,7 +74,7 @@ async fn queries(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     Ok(())
 }
 
-#[fn_handler]
+#[handler]
 async fn cached_queries(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     let count = req.query::<usize>("q").unwrap_or(1);
     let count = cmp::min(500, cmp::max(1, count));
@@ -92,7 +92,7 @@ async fn cached_queries(req: &mut Request, res: &mut Response) -> Result<(), Err
     Ok(())
 }
 
-#[fn_handler]
+#[handler]
 async fn updates(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     let count = req.query::<usize>("q").unwrap_or(1);
     let count = cmp::min(500, cmp::max(1, count));
@@ -121,7 +121,7 @@ async fn updates(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     Ok(())
 }
 
-#[fn_handler]
+#[handler]
 async fn fortunes(res: &mut Response) -> Result<(), Error> {
     let conn = connect()?;
     let mut items = fortune::table.get_results::<Fortune>(&conn)?;

+ 1 - 1
frameworks/Rust/salvo/src/main_pg.rs

@@ -264,7 +264,7 @@ impl Handler for FortunesHandler {
     }
 }
 
-#[fn_handler]
+#[handler]
 async fn cached_queries(req: &mut Request, res: &mut Response) -> Result<(), Error> {
     let count = req.query::<usize>("q").unwrap_or(1);
     let count = cmp::min(500, cmp::max(1, count));