title: How can I run a function on initialization of a struct?
body: <p>I have a struct:</p>
  <pre class="lang-rust prettyprint-override"><code>struct MyStruct {
      pub a: i32,
      pub b: i32,
  }
  </code></pre>
  <p>When instantiating <code>MyStruct</code>, I want to divide <code>a</code> by 2:</p>
  <pre class="lang-rust prettyprint-override"><code>let a = MyStruct { a: 26, b: 42 };
  println!(&quot;{:?}&quot;, a);
  // MyStruct { a: 13, b: 42 }
  </code></pre>
  <p>Is it possible for it to happen automatically or do I have to create a <code>instantiate</code> function and call it every time I create a <code>MyStruct</code>?</p>