为什么一个明显已经实现的类型没有实现一个特性?
#[derive(Queryable, Serialize)]pub struct Post { pub id: i32, pub title: String, pub text: String, pub published: bool,}
cargo run
--> src/main.rs:69:5 | 69 | Template::render("index", &results) | ^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `tasty::models::Post` | = note: required because of the requirements on the impl of `serde::ser::Serialize` for `std::vec::Vec<tasty::models::Post>` = note: required by `rocket_contrib::Template::render`
[dependencies]chrono = "0.3.0"rocket = "0.2.8"rocket_codegen = "0.2.8"serde = "1.0.8"serde_derive = "1.0.8"serde_json = "1.0.2"mysql = "11.1.2"diesel = { version = "0.13.0", features = ["mysql","chrono"] }diesel_codegen = { version = "0.13.0", features = ["mysql"] }dotenv = "0.10.0"[dependencies.rocket_contrib]version = "*"default-features = falsefeatures = ["handlebars_templates"]
Serialize
FFIVE
相关分类