You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[2021-06-06T17:49:53Z DEBUG actix_web::data] Failed to construct App-level Data extractor. Request path: "/start" (type: std::sync::mutex::Mutex<futures_channel::mpsc::Sender<battlesnake::Board>>) ... <suggestion>
Suggestion could be like missed wrapping T within Data (which happened to me, took me half an hour to figure this out). It's in the example but I didn't look closely at this part since I thought it should work since it compiled. The logging message is correct but I don't know why it failed, the type is correct but just without the Data so I didn't know that is an issue.
#[actix_web::main]asyncfnmain() -> std::io::Result<()>{let counter = web::Data::new(AppStateWithCounter{counter:Mutex::new(0),});HttpServer::new(move || {// move counter into the closureApp::new()// Note: using app_data instead of data.app_data(counter.clone())// <- register the created data.route("/", web::get().to(index))}).bind("127.0.0.1:8080")?
.run().await}
Current Behavior
[2021-06-06T17:49:53Z DEBUG actix_web::data] Failed to construct App-level Data extractor. Request path: "/start" (type: std::sync::mutex::Mutex<futures_channel::mpsc::Sender<battlesnake::Board>>)
Possible Solution
Add a suggestion on what is the expected type and the code change required. Ideally this should be done compile time but that's another issue.
Context
This will be very helpful for newcomers and even developers who made some mistakes and ease them.
Your Environment
Rust Version (I.e, output of rustc -V): rustc 1.52.1 (9bc8c42bb 2021-05-09)
Actix Web Version: 3.3.2
The text was updated successfully, but these errors were encountered:
But yeah, in rocket if the type is not correct it won't even start serving. Although it is still not as good as compile-time type checking, it starts checking when the application starts which I think is good enough. Actix-web at least still need to call the endpoint to know if it works.
Expected Behavior
Suggestion could be like missed wrapping
T
withinData
(which happened to me, took me half an hour to figure this out). It's in the example but I didn't look closely at this part since I thought it should work since it compiled. The logging message is correct but I don't know why it failed, the type is correct but just without theData
so I didn't know that is an issue.Current Behavior
Possible Solution
Add a suggestion on what is the expected type and the code change required. Ideally this should be done compile time but that's another issue.
Context
This will be very helpful for newcomers and even developers who made some mistakes and ease them.
Your Environment
rustc -V
): rustc 1.52.1 (9bc8c42bb 2021-05-09)The text was updated successfully, but these errors were encountered: