Skip to content

Commit b3cd902

Browse files
Merge pull request #9628 from shyamsundarb-arch/master
Fixed actix build error. Upgraded rust to 2024 edition
2 parents f6e9246 + 669a399 commit b3cd902

14 files changed

+1249
-790
lines changed

frameworks/Rust/actix/Cargo.lock

Lines changed: 1184 additions & 725 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/Rust/actix/Cargo.toml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tfb-actix"
3-
version = "3.0.0"
4-
edition = "2018"
3+
version = "4.0.0"
4+
edition = "2024"
55

66
[[bin]]
77
name = "tfb-web"
@@ -28,41 +28,40 @@ name = "tfb-web-pg-deadpool"
2828
path = "src/main_pg_deadpool.rs"
2929

3030
[dependencies]
31-
anyhow = "1"
32-
actix = "0.13"
33-
actix-web = "4.3.1"
34-
actix-http = "3.3.1"
35-
actix-rt = "2"
36-
actix-codec = "0.4"
31+
anyhow = "1.0.96"
32+
actix = "0.13.5"
33+
actix-web = "4.9.0"
34+
actix-http = "3.9.0"
35+
actix-rt = "2.10.0"
36+
actix-codec = "0.5"
3737
actix-server = "2"
3838
actix-service = "2"
3939

40-
askama = "0.11"
40+
askama = "0.12"
4141
bytes = "1"
42-
diesel = { version = "1.4", features = ["postgres"] }
43-
env_logger = "0.9"
44-
futures = "0.3.7"
45-
http = "0.2"
42+
diesel = { version = "2.2.7", features = ["postgres"] }
43+
env_logger = "0.11"
44+
futures = "0.3.31"
4645
log = { version = "0.4", features = ["release_max_level_debug"] }
4746
num_cpus = "1.13"
48-
rand = { version = "0.8", features = ["small_rng"] }
47+
rand = { version = "0.9", features = ["small_rng"] }
4948
serde = { version = "1", features = ["derive"] }
5049
serde_json = "1"
51-
simd-json = "0.4"
52-
simd-json-derive = "0.12"
53-
snmalloc-rs = "0.2.6"
50+
simd-json = "0.14"
51+
simd-json-derive = "0.15"
52+
snmalloc-rs = "0.3.8"
5453
tokio = { version = "1", features = ["full"] }
55-
tokio-util = "0.7.8"
56-
tokio-postgres = "0.7.5"
57-
deadpool-postgres = "0.10.1"
58-
mongodb = "2.2.0"
59-
url = "2.1"
60-
v_htmlescape = "0.14"
54+
tokio-util = "0.7.13"
55+
tokio-postgres = "0.7.13"
56+
deadpool-postgres = "0.14.1"
57+
mongodb = "3.2.1"
58+
url = "2.5"
59+
v_htmlescape = "0.15"
6160
yarte = { version = "0.15", features = ["bytes-buf"] }
6261

6362
[build-dependencies]
64-
askama = "0.11"
65-
bindgen = "0.59"
63+
askama = "0.12"
64+
bindgen = "0.71"
6665

6766
[profile.release]
6867
lto = true

frameworks/Rust/actix/actix-http.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.58
1+
FROM rust:1.85
22

33
RUN apt-get update -yqq && apt-get install -yqq cmake g++
44

frameworks/Rust/actix/actix-server.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.58
1+
FROM rust:1.85
22

33
RUN apt-get update -yqq && apt-get install -yqq cmake g++
44

frameworks/Rust/actix/actix-web-diesel.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.58
1+
FROM rust:1.85
22

33
RUN apt-get update -yqq && apt-get install -yqq cmake g++
44

frameworks/Rust/actix/actix-web-mongodb.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.57.0
1+
FROM rust:1.85
22

33
ENV ACTIX_TECHEMPOWER_MONGODB_URL=mongodb://tfb-database:27017
44

frameworks/Rust/actix/actix-web-pg-deadpool.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.57.0
1+
FROM rust:1.85
22

33
RUN apt-get update -yqq && apt-get install -yqq cmake g++
44

frameworks/Rust/actix/actix.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.58
1+
FROM rust:1.85.0
22

33
RUN apt-get update -yqq && apt-get install -yqq cmake g++
44

frameworks/Rust/actix/benchmark_config.json

100755100644
File mode changed.

frameworks/Rust/actix/src/db.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use bytes::{Bytes, BytesMut};
66
use futures::{
77
stream::futures_unordered::FuturesUnordered, FutureExt, StreamExt, TryStreamExt,
88
};
9-
use rand::{rngs::SmallRng, thread_rng, Rng, SeedableRng};
9+
use rand::{rngs::SmallRng, Rng, SeedableRng};
1010
use tokio_postgres::{connect, types::ToSql, Client, NoTls, Statement};
1111

1212
use crate::{
@@ -101,9 +101,9 @@ impl PgConnection {
101101
}
102102

103103
pub async fn get_world(&self) -> Result<Bytes, PgError> {
104-
let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
104+
let mut rng = SmallRng::from_rng(&mut rand::rng());
105105

106-
let random_id = (rng.gen::<u32>() % 10_000 + 1) as i32;
106+
let random_id = (rng.random::<u32>() % 10_000 + 1) as i32;
107107

108108
let world = self.query_one_world(random_id).await?;
109109
let mut body = BytesMut::with_capacity(40);
@@ -113,26 +113,26 @@ impl PgConnection {
113113
}
114114

115115
pub async fn get_worlds(&self, num: usize) -> Result<Vec<World>, PgError> {
116-
let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
116+
let mut rng = SmallRng::from_rng(&mut rand::rng());
117117

118118
let worlds = FuturesUnordered::new();
119119

120120
for _ in 0..num {
121-
let w_id = (rng.gen::<u32>() % 10_000 + 1) as i32;
121+
let w_id = (rng.random::<u32>() % 10_000 + 1) as i32;
122122
worlds.push(self.query_one_world(w_id));
123123
}
124124

125125
worlds.try_collect().await
126126
}
127127

128128
pub async fn update(&self, num: u16) -> Result<Vec<World>, PgError> {
129-
let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
129+
let mut rng = SmallRng::from_rng(&mut rand::rng());
130130

131131
let worlds = FuturesUnordered::new();
132132

133133
for _ in 0..num {
134-
let id = (rng.gen::<u32>() % 10_000 + 1) as i32;
135-
let w_id = (rng.gen::<u32>() % 10_000 + 1) as i32;
134+
let id = (rng.random::<u32>() % 10_000 + 1) as i32;
135+
let w_id = (rng.random::<u32>() % 10_000 + 1) as i32;
136136

137137
worlds.push(self.query_one_world(w_id).map(move |res| match res {
138138
Ok(mut world) => {

0 commit comments

Comments
 (0)