Hi,
I'm currently trying to implement something simple using actix.
I found the examples repository which is quiet nice although I tried two examples so far and none of them compiled using the up to date versions of the corresponding crates and rust 1.42.0.
Currently I'm trying out the handlebars example because I'm familiar with handlebars (in general, not the rust implementation):
I get two different compile errors which I'm unable to understand.
In the docs for handlebars I couldn't find a mention of the lifetime specifier for the Handlebars struct. Still, the compiler complains about it being missing:
error[E0726]: implicit elided lifetime not allowed here
--> src/main.rs:16:30
|
16 | async fn index(hb: web::Data<Handlebars>) -> HttpResponse {
| ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>
Even more confusing for me is the error:
error[E0599]: no method named `register_templates_directory` found for struct `handlebars::registry::Registry<'_>` in the current scope
--> src/main.rs:46:10
|
46 | .register_templates_directory(".html", "./static/templates")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `register_template_file`
That's because register_templates_directory is neither deprecated nor missing. So why doesn't the compiler find it?
Your provided link to the handlebars doc is to version 3.1.0-beta.1, whereas your Cargo.toml uses 3.0.1. Please ensure that you are viewing the documentation for the crate you are using. That said, if you update the link to this, the function still exists.
I'm not quite sure why you're getting the error you're getting. As for the lifetime, you can see it by selecting "Show declaration" at the top of the page.
It's also quite confusing how they have reexported a struct named Registry as Handlebars... You can see this by pressing [src] on the page.
Can you try compiling the doc locally with cargo doc and checking that version?