Browse Source

Salvo: upgrade version 0.25 (#7420)

* Salvo: upgrade version 0.25

* Upgrade rust version

* Salvo: version 0.26
Chrislearn Young 3 years ago
parent
commit
77122820c5

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

@@ -26,11 +26,11 @@ 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.24", features = ["anyhow"] }
+salvo = { version = "0.26", features = ["anyhow"] }
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0.81"
 smallvec = "1.6.1"
-snmalloc-rs = { version = "0.2.24", features = ["1mib", "native-cpu"] }
+snmalloc-rs = { version = "0.3", features = ["native-cpu"] }
 tokio = { version = "1", features = ["macros", "rt"] }
 tokio-postgres = "0.7.2"
 v_htmlescape = "0.14"

+ 1 - 1
frameworks/Rust/salvo/README.md

@@ -2,4 +2,4 @@
 
 ## Description
 
-Salvo is a simple but powerful web server framework written in Rust.
+Salvo is a powerful and simplest web server framework in Rust world.

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

@@ -1,4 +1,4 @@
-FROM rust:1.60.0
+FROM rust:1.61.0
 
 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.60.0
+FROM rust:1.61.0
 
 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.60.0
+FROM rust:1.61.0
 
 # Disable simd at jsonescape
 ENV CARGO_CFG_JSONESCAPE_DISABLE_AUTO_SIMD=

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

@@ -4,7 +4,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
 use std::sync::Arc;
 use std::thread::available_parallelism;
 
-use bytes::BytesMut;
+use bytes::Bytes;
 use salvo::http::header::{self, HeaderValue};
 use salvo::http::response::Body;
 use salvo::prelude::*;
@@ -27,7 +27,7 @@ fn json(res: &mut Response) {
         message: "Hello, World!",
     })
     .unwrap();
-    res.set_body(Body::Bytes(BytesMut::from(data.as_slice())));
+    res.set_body(Body::Once(Bytes::from(data)));
 }
 
 #[fn_handler]
@@ -35,7 +35,7 @@ fn plaintext(res: &mut Response) {
     let headers = res.headers_mut();
     headers.insert(header::SERVER, HeaderValue::from_static("S"));
     headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/plain"));
-    res.set_body(Body::Bytes(BytesMut::from(HELLO_WORLD)));
+    res.set_body(Body::Once(Bytes::from_static(HELLO_WORLD)));
 }
 
 fn main() {