title: mysql - the trait `diesel::Expression` is not implemented for `f64`
body: <p>I'm trying to set up a model using diesel and mysql. My first model compiles without issue but when my second model, the one meant for inserting a new entry to my DB, tries to derive <code>Insertable</code> I get a slew of errors stating that diesel can't use <code>f64</code>, <code>u16</code>, or <code>NaiveDateTime</code></p>
  <pre><code>error[E0277]: the trait bound `u16: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u16`
     |
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Unsigned&lt;diesel::sql_types::Integer&gt;&gt;` for `u16`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `chrono::naive::datetime::NaiveDateTime: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `chrono::naive::datetime::NaiveDateTime`
     |
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Date&gt;` for `chrono::naive::datetime::NaiveDateTime`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `f64: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `f64`
     |
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Float&gt;` for `f64`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `u16: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u16`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;u16`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Unsigned&lt;diesel::sql_types::Integer&gt;&gt;` for `&amp;u16`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `chrono::naive::datetime::NaiveDateTime: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `chrono::naive::datetime::NaiveDateTime`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;chrono::naive::datetime::NaiveDateTime`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Date&gt;` for `&amp;chrono::naive::datetime::NaiveDateTime`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `f64: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `f64`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;f64`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Float&gt;` for `&amp;f64`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `u16: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u16`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;'insert u16`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Unsigned&lt;diesel::sql_types::Integer&gt;&gt;` for `&amp;'insert u16`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `chrono::naive::datetime::NaiveDateTime: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `chrono::naive::datetime::NaiveDateTime`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;'insert chrono::naive::datetime::NaiveDateTime`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Date&gt;` for `&amp;'insert chrono::naive::datetime::NaiveDateTime`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  
  error[E0277]: the trait bound `f64: diesel::Expression` is not satisfied
    --&gt; src/models.rs:26:10
     |
  26 | #[derive(Insertable, Debug, Queryable)]
     |          ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `f64`
     |
     = note: required because of the requirements on the impl of `diesel::Expression` for `&amp;'insert f64`
     = note: required because of the requirements on the impl of `diesel::expression::AsExpression&lt;diesel::sql_types::Float&gt;` for `&amp;'insert f64`
     = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
  </code></pre>
  <p>Here's my models.rs file</p>
  <pre><code>use crate::schema::*;
  use serde::{Deserialize, Serialize};
  use chrono::NaiveDateTime;
  
  #[derive(Debug, Serialize, Deserialize, Queryable)]
  pub struct Site {
      pub site_id: i32,
      pub name: String,
      pub slug: String,
      pub rack_size: u16,
      pub date_created: chrono::NaiveDateTime,
      pub latitude: f64,
      pub longitude: f64 
  }
  
  //#[derive(Insertable, Debug, Queryable)]
  //#[table_name = &quot;site&quot;]
  //pub struct NewSite&lt;'a&gt; {
  //    pub name: &amp;'a str,
  //    pub slug: &amp;'a str,
  //    pub rack_size: &amp;'a  u16,
  //    pub date_created: chrono::NaiveDateTime,
  //    pub latitude: &amp;'a f64,
  //    pub longitude: &amp;'a f64
  //}
  #[derive(Insertable, Debug, Queryable)]
  #[table_name = &quot;site&quot;]
  pub struct NewSite {
      pub name: String,
      pub slug: String,
      pub rack_size: u16,
      pub date_created: chrono::NaiveDateTime,
      pub latitude: f64,
      pub longitude: f64 
  }
  </code></pre>
  <p>And my Cargo.toml</p>
  <pre><code>[package]
  name = &quot;micd&quot;
  version = &quot;0.1.0&quot;
  authors = [&quot;First Last &lt;no@gmail.com&gt;&quot;]
  edition = &quot;2018&quot;
  
  [dependencies]
  actix-web = &quot;2.0.0&quot;
  actix-web-httpauth = { git = &quot;https://github.com/actix/actix-web-httpauth&quot; }
  chrono = { version = &quot;0.4.10&quot;, features = [&quot;serde&quot;] }
  derive_more = &quot;0.99.2&quot;
  diesel = { version = &quot;1.4.2&quot;, features = [&quot;extras&quot;, &quot;mysql&quot;, &quot;default&quot;] }
  dotenv = &quot;0.15.0&quot;
  futures = &quot;0.3.1&quot;
  r2d2 = &quot;0.8.8&quot;
  serde = &quot;1.0&quot;
  serde_derive = &quot;1.0&quot;
  serde_json = &quot;1.0&quot;
  actix-service = &quot;1.0.1&quot;
  alcoholic_jwt = &quot;1.0.0&quot;
  reqwest = &quot;0.9.22&quot;
  actix-rt = &quot;1.0.0&quot;
  </code></pre>
  <p>I've tried importing the numeric feature in diesel as suggested by <a href="https://stackoverflow.com/questions/55783064/the-trait-dieselexpression-is-not-implemented-for-bigdecimalbigdecimal">the only SO question I could find that relates to this</a>. All guides I've looked at just walk right past this issue and I can't see what I might be doing wrong.</p>