Selaa lähdekoodia

fix: build of sib (#9992)

* refactor: rename message to util

* fix: clippy
Outer Heaven Legacy 2 kuukautta sitten
vanhempi
commit
ef2558b6dd
2 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 1 1
      frameworks/Rust/sib/Cargo.toml
  2. 7 7
      frameworks/Rust/sib/src/main.rs

+ 1 - 1
frameworks/Rust/sib/Cargo.toml

@@ -17,7 +17,7 @@ sib = { git = "https://github.com/PooyaEimandar/sib", default-features = false,
 ] }
 bytes = { version = "1.10.1", default-features = false }
 mimalloc = { version = "0.1.47", features = ["secure"] }
-num_cpus = { version = "1.16" }
+num_cpus = { version = "1.17.0" }
 serde = { version = "1.0.219", default-features = false, features = ["derive"] }
 serde_json = { version = "1.0.140" }
 

+ 7 - 7
frameworks/Rust/sib/src/main.rs

@@ -1,7 +1,7 @@
 use bytes::Bytes;
 use sib::network::http::{
     h1::{H1Service, H1ServiceFactory},
-    message::Status,
+    util::Status,
     session::Session,
 };
 use std::{
@@ -63,7 +63,7 @@ impl H1ServiceFactory for H1Server<HService> {
 fn main() {
     // Print number of CPU cores
     let cpus = num_cpus::get();
-    println!("CPU cores: {}", cpus);
+    println!("CPU cores: {cpus}");
 
     // Print total RAM in MB
     if let Ok(meminfo) = fs::read_to_string("/proc/meminfo") {
@@ -73,7 +73,7 @@ fn main() {
                 if parts.len() >= 2 {
                     if let Ok(kb) = parts[1].parse::<u64>() {
                         let mb = kb / 1024;
-                        println!("Total RAM: {} MB", mb);
+                        println!("Total RAM: {mb} MB");
                     }
                 }
                 break;
@@ -88,12 +88,12 @@ fn main() {
     for _ in 0..cpus {
         let handle = std::thread::spawn(move || {
             let id = std::thread::current().id();
-            println!("Listening {} on thread: {:?}", addr, id);
+            println!("Listening {addr} on thread: {id:?}");
             H1Server(HService)
-                .start(addr, cpus, 0, None)
-                .expect(&format!("h1 server failed to start for thread {:?}", id))
+                .start(addr, cpus, 0)
+                .unwrap_or_else(|_| panic!("h1 server failed to start for thread {id:?}"))
                 .join()
-                .expect(&format!("h1 server failed to joining thread {:?}", id));
+                .unwrap_or_else(|_| panic!("h1 server failed to joining thread {id:?}"));
         });
         threads.push(handle);
     }