我想在一个模块中启动 Rocket main()
,因此可以简化main()
但我失败了。我从Rocket修改了Quicktart
编码:
mod myRocket {
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
pub fn startup() {
rocket::ignite().mount("/", routes![index]).launch();
}
}
fn main() {
myRocket::startup();
}
错误:
error: cannot find macro `routes!` in this scope
--> src\main.rs:12:37
|
12 | rocket::ignite().mount("/", routes![index]).launch();
|
我不知道如何解决它。