2017-06-04 9 views
2

ロケットを手に入れることができませんhandlebars example 未解決のインポートテンプレートロケットハンドルバーを構築するとき

[dependencies] 
rocket = "*" 
rocket_codegen = "*" 
rocket_contrib = "*" 
serde = "*" 
serde_json = "*" 
serde_derive = "*" 

エラー:これらは私のCargo.toml依存関係です

error[E0432]: unresolved import `rocket_contrib::Template` 
    --> src\main.rs:29:5 
    | 
29 | use rocket_contrib::Template; 
    |  ^^^^^^^^^^^^^^^^^^^^^^^^ no `Template` in the root 

error[E0599]: no method named `attach` found for type `rocket::Rocket` in the current scope 
    --> src\main.rs:62:10 
    | 
62 |   .attach(Template::fairing()) 
    |   ^^^^^^ 

最初のエラーがTemplateを探し、それを見つけることができません。この例のgit repoには存在しません。この例はどのように機能しますか?私はmain.rsのRustコードが大丈夫だと確信しています、それは例と同じです。私はそれが唯一の依存問題だと思う。

error[E0599]: no method named `attach` found for type `rocket::Rocket` in the current scope 
    --> src\main.rs:62:10 
    | 
62 |   .attach(Template::fairing()) 
    |   ^^^^^^ 

error[E0599]: no associated item named `fairing` found for type `rocket_contrib::Template` in the current scope 
    --> src\main.rs:62:17 
    | 
62 |   .attach(Template::fairing()) 
    |     ^^^^^^^^^^^^^^^^^ 

答えて

3

あなたはhandlebars_templates機能が欠落しています

[dependencies] 
rocket = "*" 
rocket_codegen = "*" 
serde = "*" 
serde_json = "*" 
serde_derive = "*" 

[dependencies.rocket_contrib] 
version = "*" 
features = ["handlebars_templates"] 

は今、私はこれらのエラーを取得:

は、私は私にCargo.tomlを変えました。あなたはできます see this in the example's Cargo.toml

[dependencies.rocket_contrib] 
version = "*" # Not a good idea to use * as version 
features = ["handlebars_templates"] 
関連する問題