I am trying to build a chatbot using Rustformers LLM and some other tools. The main.rs file is strangely producing Cannot find value `css` in this scope [E0425] even when the function is defined in the right scope and is accessible. I tried moving it out of the main function but the error persists. Any suggestions?
use cfg_if::cfg_if;
use api::ws;
pub mod api;
pub mod model;
#[cfg(feature = "ssr")]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "debug");
env_logger::init();
use actix_files::Files;
use actix_web::*;
use leptos::*;
use leptos_actix::{generate_route_list, LeptosRoutes};
use rusty_llama::app::*;
let conf = get_configuration(None).await.unwrap();
let addr = conf.leptos_options.site_addr;
let routes = generate_route_list(|| view! { <App/> });
#[get("/style.css")]
async fn css() -> impl Responder { // --> The function
actix_files::NamedFile::open_async("./style/output.css").await
}
let model = web::Data::new(get_language_model());
HttpServer::new(move || {
let leptos_options = &conf.leptos_options;
let site_root = &leptos_options.site_root;
App::new()
.app_data(model.clone())
.service(css) // --> Error in this line
.route("/ws", web::get().to(ws))
.route("/api/{tail:.*}", leptos_actix::handle_server_fns())
.leptos_routes(
leptos_options.to_owned(),
routes.to_owned(),
|| view! { <App/> },
)
.service(Files::new("/", site_root))
})
.bind(&addr)?
.run()
.await
}