title: Binary operation `==` cannot be applied to type X
body: <p>I have a custom type:</p>
  
  <pre><code>pub struct PValue {
      pub name: String,
      pub value: Option&lt;serde_json::Value&gt;,
      pub from: Option&lt;String&gt;,
  }
  pub struct CC {
      pub name: String,
      pub inst_name: String,
      pub pv: Option&lt;Vec&lt;PValue&gt;&gt;,
  }
  
  pub struct ComponentRecord {
      config: CC,
      version: String,
  }
  
  let cr = ComponentRecord {
          version: "123".to_string(),
          config: CC {
              name: "n123".to_string(),
              instance_name: "inst123".to_string(),
              pv: None,
          },
      };
  let newcr = ComponentRecord {
          version: "123".to_string(),
          config: ComponentConfiguration {
              name: "n123".to_string(),
              instance_name: "inst123".to_string(),
              pv: None,
          },
      };
  assert_eq!(crgot, cr);
  </code></pre>
  
  <p>Then I got error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0369]: binary operation `==` cannot be applied to type `&amp;ComponentRecord`
    --&gt; src/xxx_test.rs:39:5
     |
  39 |     assert_eq!(crgot, cr);
     |     ^^^^^^^^^^^^^^^^^^^^^^
     |     |
     |     ComponentRecord
     |     ComponentRecord
     |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `&amp;ComponentRecord`
  </code></pre>
  
  <p>How could I test two <code>RecordAnnotation</code> instance is equal?</p>
  
  <p>I was writing test for that, so I won't mind whether the performance is ok.</p>
  
  <p>In golang, I can use <a href="https://golang.org/pkg/reflect/#DeepEqual" rel="noreferrer">reflect.DeepEqual</a> to do that. I hope to find a common way to do in rust.</p>