title: How to Serialize context for Template::render
body: <p>I'm trying to use Handlebars with Rocket and Diesel. Unfortunately I didn't get this combination to work.</p>
  
  <p>First I build a simple rest-API using <a href="https://dzone.com/articles/creating-a-rest-api-in-rust-using-rocket-and-diese" rel="nofollow noreferrer">this tutorial</a>. Then I tried to test a handlebars-template without using the database-connection. This part works great.</p>
  
  <p>Next I tried the same template with use of the database-connection. If I use the same methods as in the API for the context-part oft the Template, I get compiler messages which I don't understand. In case that the REST API uses JSON from serde, I expected that the output should be <code>Serialize</code>.</p>
  
  <p>The faulty function:</p>
  
  <pre><code>#[get("/&lt;id&gt;")]
  pub fn index(id: i32, connection: DbConn) -&gt; Template
  {
      let context = people::repository::index(id, &amp;connection).map(|person| Json(person)).map_err(|error| error_status(error));
      Template::render("index", &amp;context)
  };
  </code></pre>
  
  <p>The struct:</p>
  
  <pre><code>#[derive(Queryable, AsChangeset, Serialize, Deserialize)]
  #[table_name = "people"]
  pub struct Person {
      pub id: i32,
      pub first_name: String,
      pub last_name: String,
      pub age: i32,
      pub profession: String,
      pub salary: i32,
  };
  </code></pre>
  
  <p>The database query:</p>
  
  <pre><code>pub fn index(id: i32, connection: &amp;PgConnection ) -&gt; QueryResult&lt;Person&gt; {
      people::table.find(id).get_result::&lt;Person&gt;(connection)
  }
  </code></pre>
  
  <p>I expect a successful compilation. The error messages are as follows:</p>
  
  <pre><code>[E0277] the trait bound `rocket_contrib::json::Json&lt;people::Person&gt;: people::_IMPL_DESERIALIZE_FOR_Person::_serde::Serialize` is not satisfied. 
  [Note] the trait `people::_IMPL_DESERIALIZE_FOR_Person::_serde::Serialize` is not implemented for `rocket_contrib::json::Json&lt;people::Person&gt;`
  [E0277] the trait bound `rocket::http::Status: people::_IMPL_DESERIALIZE_FOR_Person::_serde::Serialize` is not satisfied. 
  [Note] the trait `people::_IMPL_DESERIALIZE_FOR_Person::_serde::Serialize` is not implemented for `rocket::http::Status`
  </code></pre>