DEV Community

Discussion on: A Web App in Rust - 09 A New Index Page

Collapse
 
tonylee3737 profile image
tonylee3737

Error occurs.
: data.insert("posts_users", &all_posts);
^^^^^^^^^^ the trait Serialize is not implemented for Post
*Fix here.

.model.rs

[derive(Debug, Queryable, Serialize)] <- add this Serialize

pub struct Post {
pub id: i32,
pub title: String,
pub link: Option,
pub author: i32,
pub created_at: chrono::NaiveDateTime,
}

Thanks for your effort :)