I'm trying to learn some rust by my usual method of flailing around and running examples.
This page on the rust_contrib api docs makes me think I can serve static files https://api.rocket.rs/master/rocket_contrib/serve/struct.StaticFiles.html like this...
use rocket_contrib::serve::StaticFiles;
use rocket_contrib::serve::crate_relative;
...
fn main() {
rocket::ignite()
.mount("/content", StaticFiles::from(crate_relative!("content")))
.mount("/", routes![index])
.mount("/api", routes![hello, new_book])
.register(catchers![not_found])
.attach(Template::fairing())
.launch();
}
Instead the compiler barks at me...
error[E0432]: unresolved import `rocket_contrib::serve::crate_relative`
--> src/main.rs:9:5
|
9 | use rocket_contrib::serve::crate_relative;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `crate_relative` in `serve`
Cargo.toml looks like this...
[package]
name = "rocket-web"
version = "0.1.0"
authors = ["Nunya B. Znas <dontworry@bout.it>"]
edition = "2018"
[dependencies]
rocket = "0.4.5"
serde = {version = "1.0", features = ["derive"]}
[dependencies.rocket_contrib]
version = "0.4.5"
features = ["handlebars_templates", "tera_templates"]
What have I done to offend the rust gods?
Thanks