なぜか最初はstatic使えなかったので、
app.rs
use std::path::Path; use async_trait::async_trait; use loco_rs::{ app::{AppContext, Hooks}, // 追加 boot::{create_app, BootResult, StartMode}, controller::AppRoutes, db::{self, truncate_table}, // 追加 environment::Environment, task::Tasks, worker::{AppWorker, Processor}, Result, }; // 追加 use migration::Migrator; use sea_orm::DatabaseConnection; use crate::{ controllers, models::_entities::{notes, users}, tasks, workers::downloader::DownloadWorker, }; pub struct App; #[async_trait] impl Hooks for App { fn app_name() -> &'static str { env!("CARGO_CRATE_NAME") } // 追加 fn app_version() -> String { format!( "{} ({})", env!("CARGO_PKG_VERSION"), option_env!("BUILD_SHA") .or(option_env!("GITHUB_SHA")) .unwrap_or("dev") ) } // 追加 // fn boot(mode: StartMode, environment: Environment) -> BootResult { async fn boot(mode: StartMode, environment: &Environment) -> Result<BootResult> { // create_app::<Self, Migrator>(mode, "develop").await create_app::<Self, Migrator>(mode, environment).await } // fn routes() -> AppRoutes { fn routes(_ctx: &AppContext) -> AppRoutes { AppRoutes::with_default_routes() .add_route(controllers::comment::routes()) .add_route(controllers::articles::routes()) .add_route(controllers::guide::routes()) .add_route(controllers::notes::routes()) .add_route(controllers::auth::routes()) .add_route(controllers::user::routes()) }
loco-rs = { version = "0.1.6" }
↓
loco-rs = { version = "0.2.3" }
このバージョン違い?
この辺も
#async-trait = "0.1.0" async-trait = "0.1.77"