I must admit, I am having a hard time making sense of the Rust compiler error messages.
I have this module:
src/adapters.js
use actix_web::{Responder, HttpResponse};
pub mod Basic {
pub fn api_index() -> &'static str {
"API"
}
pub fn admin_index() -> impl Responder {
HttpResponse::Ok().body("hello world!")
}
}
The Rust compiler keeps telling me when I use
use crate::actix_web::{Responder, HttpResponse};
that:
E0432: unresolved import `crate::actix_web` maybe a missing crate `actix_web`?
Rest assured, crate::actix_web is not missing, because I can run simple requests from main.rs. The problem starts when I want to use the actix_web modules within my own modules.
If I have
use actix_web::{Responder, HttpResponse};
Rust keeps teeling me:
error[E0433]: failed to resolve: use of undeclared type or module `HttpResponse`
HttpResponse::Ok().body("hello world!")
^^^^^^^^^^^^ not found in this scope
help: consider importing one of these items
use actix_web::HttpResponse;
use crate::adapters::HttpResponse;
E0432: unresolved import `crate::actix_web` maybe a missing crate `actix_web`?
I my main.rs, as the first line, I've also declared:
extern crate actix_web;
For the sake of making sure, I've also added "extern crate actix_web;" to the adapters.rs module right at the start. That didn't change anything either.
I am running out of options, I don't know what else I could possibly do.