title: What is the difference between <T: Trait> Box<T> and &Trait / Box<Trait>?
body: <p>When writing code with traits you can put the trait in a trait bound:</p>
  
  <pre><code>use std::fmt::Debug;
  
  fn myfunction1&lt;T: Debug&gt;(v: Box&lt;T&gt;) {
      println!("{:?}", v);
  }
  
  fn myfunction2&lt;T: Debug&gt;(v: &amp;T) {
      println!("{:?}", v);
  }
  
  fn main() {
      myfunction1(Box::new(5));
      myfunction2(&amp;5);
  }
  </code></pre>
  
  <p>Or directly in a <code>Box</code> or reference type:</p>
  
  <pre><code>use std::fmt::Debug;
  
  fn myfunction3(v: Box&lt;Debug&gt;) {
      println!("{:?}", v);
  }
  
  fn myfunction4(v: &amp;Debug) {
      println!("{:?}", v);
  }
  
  fn main() {
      myfunction3(Box::new(5));
      myfunction4(&amp;5);
  }
  </code></pre>
  
  <p>These give the same output. So what is the difference?</p>
  
  <p>(This question was inspired by <a href="https://stackoverflow.com/questions/45148102/what-is-the-reason-why-this-generic-type-not-work-but-type-alias-is-ok#45148102">another question</a> where this was just one of several intermingled concepts)</p>