title: How should I manage structures that can be formatted differently in many places in programs but are not my type?
body: <p>I want to create a structure called <code>Timeout</code> that is exactly <code>std::time::Duration</code> but implement <code>Display</code> trait for it.</p>
  
  <h2>Background</h2>
  
  <p>I want to use the <a href="https://crates.io/crates/query_params" rel="nofollow noreferrer">query_params</a> crate on my structure that looks like:</p>
  
  <pre><code>#[macro_use]
  extern crate query_params;
  use std::time::Duration;
  
  #[derive(QueryParams)]
  struct PullRequestsParametersApi {
      page: Option&lt;i32&gt;,
      timeout: Option&lt;Duration&gt;,
  }
  
  fn main() {
      let pr = PullRequestsParametersApi {
          page: Some(32),
          timeout: None,
      };
  
      println!("Query=  {} &lt;&lt;end", pr.to_query_params());
  }
  </code></pre>
  
  <p>This causes a compiler error:</p>
  
  <pre class="lang-none prettyprint-override"><code>--&gt; src/main.rs:5:10
    |
  5 | #[derive(QueryParams)]
    |          ^^^^^^^^^^^ `std::time::Duration` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
    |
    = help: the trait `std::fmt::Display` is not implemented for `std::time::Duration`
    = note: required because of the requirements on the impl of `std::fmt::Display` for `&amp;std::time::Duration`
    = note: required by `std::fmt::Display::fmt`
  </code></pre>