From beede75cefd5ae52c2d81b7f183cfa41953b09a4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 21 Nov 2017 23:19:05 +0100 Subject: Derive FromForm for models::Post. This allows us to pass in forms that will translate into proper form objects. --- src/lib.rs | 3 +++ src/models.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 097dc66..c950e7a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +#![feature(plugin, custom_derive)] +#![plugin(rocket_codegen)] + #[macro_use] extern crate diesel_codegen; pub mod models; diff --git a/src/models.rs b/src/models.rs index a0152c0..d8aa0aa 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,4 +1,4 @@ -#[derive(Default, Serialize, Queryable)] +#[derive(Debug, Default, FromForm, Serialize, Queryable)] pub struct Post { pub id: i32, pub title: String, -- cgit v1.2.3