When running cargo run --bin aardwolf-server or cargo run --bin aardwolf-server --features actix the following Warning would show up:
warning: unused `Server` that must be used
--> aardwolf-actix/src/lib.rs:179:5
|
179 | / HttpServer::new(move || {
180 | | let state = AppConfig {
181 | | generator: url_generator.clone(),
182 | | pool: pool.clone(),
... |
230 | | .bind(&listen_address)?
231 | | .run();
| |__________^
|
= note: Server does nothing unless you `.await` or poll it
= note: `#[warn(unused_must_use)]` on by default
This actually turned out to be a breaking error because the HttpServer was never actually told to run.
Solution
So... with the help of CodeGPT (I kid you not...) I was able to fix enough of the lib.rs to bring up the HttpServer again.
ChatGPT Explaination:
Since the run function is not declared as async, you cannot directly use the .await method. One possible solution is to use a block_on to run the asynchronous runtime and then use execute to run the server:
{ Rust Code Block }
Note that you need to spawn a separate thread to run the HttpServer with tokio::runtime::Runtime::new().unwrap().block_on(async { ... }) since you cannot directly use .await in a synchronous function.
The provided code still had errors but VS Code: Rust Analyzer was able to guide me through the rest of the fixes.
Problem
When running
cargo run --bin aardwolf-server
orcargo run --bin aardwolf-server --features actix
the following Warning would show up:This actually turned out to be a breaking error because the
HttpServer
was never actually told to run.Solution
So... with the help of CodeGPT (I kid you not...) I was able to fix enough of the
lib.rs
to bring up theHttpServer
again.ChatGPT Explaination:
The provided code still had errors but
VS Code: Rust Analyzer
was able to guide me through the rest of the fixes.