531 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
64
views
Actix-web + Tokio: Server hangs when using tokio::spawn with Arc<Mutex> loop
I am facing an issue where my Actix-web server starts correctly, but the moment I hit the /upload_chunk endpoint from my frontend, the request hangs forever.
After some debugging, I found that the ...
5
votes
2
answers
127
views
Actix Web server fails to restart on the same port when on WSL
I'm developing a simple Actix Web backend in Rust and running it on WSL (Windows Subsystem for Linux).
The server runs fine the first time, but when I use cargo watch -x run to auto-restart it on code ...
0
votes
1
answer
77
views
How to serialize the response of custom body extractor in rust actix-web?
I created a custom extractor that automatically runs validation on the request body:
pub struct ValidatedJson<T>(pub T);
impl<T> FromRequest for ValidatedJson<T>
where
T: ...
-3
votes
1
answer
93
views
lifetime handling for async code in actix extractor
Goal
I want to execute a GET request in an actix-web extractor, in order obtain additional information from a header.
Steps taken
I have tried simply making a blocking get request to avoid the need ...
3
votes
1
answer
144
views
How to kill a task that runs alongside the main program?
I have the following code where I start an Actix Web server and a queue handler task.
When I press Ctrl+C, I want both the HTTP server and the queue handler to shut down gracefully.
Currently, the ...
0
votes
1
answer
75
views
Actix variable path
Is there a way to rewrite: #[get("/status")] as #[get(status_strip_variable)]?
I cannot seem to find any example of path stored in a variable. Or maybe the use of get as a macro prevents us ...
3
votes
1
answer
205
views
What does Arc do in rust?
I am working on a web application built in rust using actix-web. What I see as recommendation is to put shared state in an Arc. So, I am trying to understand why Arc is needed, and what I have ...
0
votes
1
answer
81
views
Problems to parallel or thread an Actix_web Server
I wish to resolve the following code, but Rust panics because the actix future server() does not implement the trait Send. I didn't find a way to paralelize the actix server whithout error.
use tokio::...
0
votes
0
answers
104
views
Passing a db service to actix-web handlers in rust
I followed a simple tutorial to get an actix-web server running quickly.
Basically I start it like this:
impl ServiceServer {
pub fn new(db: ReserveDB) -> Self {
Self { db }
}
#[...
-1
votes
1
answer
68
views
Trying to pass in memory data store around
I'm hacking at an Actix API server, and I need to track objects in memory in a hashmap and pass them around between different threads. To do that, I'm passing in a Storage object to the app_data of ...
1
vote
1
answer
166
views
How do I implement error handler as a middleware function in Actix Web?
I want to implement a middleware that modifies the response error text (and maybe the Content-Type header). So I tried following:
App::new()
...
.wrap_fn(|req, srv| {
srv.call(req).map(...
0
votes
1
answer
148
views
sqlx fails with "unsupported data type DecimalN"
I have been trying to find a good way to create an express.js like backend using Rust. Everything seems to be going really well except for the fact that I can't find a good way connect and query a SQL ...
0
votes
0
answers
70
views
Rust actix web Handler<'_> not implemented
This is my first time using the actix-web crate with handlebars. I have written a simple hello world program that will not compile.
here is my Cargo.Toml
[dependencies]
actix-web = "4"
...
2
votes
1
answer
48
views
I need a real struct after a web::Json deserialize
All examples about receiving a Json by POST are like this one. Json is received, deserialized and then used directly.
#[derive(Deserialize)]
struct Info {
username: String,
}
async fn index(info: ...
2
votes
1
answer
120
views
How do I process mutexes concurrently in web data in Actix web?
I am developing a web service using actix-web that has an AppState (implemented as web::Data) and I want to make AppState editable via the API keeping the concurrent processing between the enitities ...