title: Access field of a generic type in function
body: <p>I have spent the last 4 days trying to figure this one out and I'm really really stuck. Basically I have a large number of similar structs, all containing one particular field. let's call it <code>data</code> of type u32:</p>
  <pre><code>struct A {
      data: u32,
  }
  
  struct B {
      data: u32
  }
  
  ...
  
  struct N {
      data: u32
  }
  </code></pre>
  <p>What I need to do is write a function outside those structs, which takes a generic type (that is, either one of those structs) perform some manipulation on the field and return the value. Basically something along the lines of:</p>
  <pre><code>fn some_manipulation&lt;T&gt;(st: &amp;T) -&gt; u32 {
      st.data * 10
  }
  </code></pre>
  <p>Which, as it stands, is not possible because there is no <code>data</code> field on type <code>T</code>. Another thing is I cannot modify the structs. Is there a sensible way to achieve this?</p>