-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Setup
Versions
-
Rust:
rustc 1.25.0-nightly -
Rocket:
0.3.8 (Apr 07, 2018) -
Diesel:
version = "1.1.0" -
Database:
PGsql 10.3 -
Operating System
Windows 10 Fall creators update
Feature Flags
chrono = { version = "0.4", features = ["serde"] }
- diesel:
diesel = { version = "1.1.0", features = ["postgres", "chrono", "large-tables" ] }
Problem Description
I got a "NaiveDate" field at a diesel insertable struct that derives from rocket's request::FromForm and the trait bound models::chrono::NaiveDate: rocket::request::FromFormValue<'_>
is not being satisfied.
#[derive(Insertable, Debug, FromForm)]
#[table_name="login"]
pub struct NewLogin {
pub username: String,
pub userpass: String,
pub creation_date: Option<self::chrono::NaiveDate>,
}
What is the expected output?
Successful compiling xD
What is the actual output?
error[E0277]: the trait bound
models::chrono::NaiveDate: rocket::request::FromFormValue<'>is not satisfied --> examples\freedu\src\models.rs:116:29 | 116 | #[derive(Insertable, Debug, FromForm)] | ^^^^^^^^ the trait
rocket::request::FromFormValue<'>is not implemented for
models::chrono::NaiveDate| = note: required because of the requirements on the impl of
rocket::request::FromFormValue<'_>for
std::option::Optionmodels::chrono::NaiveDate``
Steps to reproduce
- Create a struct with NaiveDate as a field type.
- Use "LanientForm" from rocket.rs to fill it.
- Add Derive(FromForm) to the struct;
- Bug.
Full code source:
https://github.com/luis-vmjr/freedu/blob/master/src/models.rs
Checklist
- [X ] I have already looked over the issue tracker for similar issues.