title: Whats the idiomatic way to reference BufReader/BufWriter when passing it between functions?
body: <p>After reading the <a href="https://doc.rust-lang.org/std/io/struct.BufReader.html" rel="nofollow noreferrer"><code>std::io::BufReader</code></a> docs, I'm not sure how to best pass a <code>BufReader</code> between functions. Multiple permutations are allowed, but which is best?</p>
  <p>I have a function that takes a file:</p>
  <pre><code>use std::{fs::File, io::BufReader};
  
  fn read_some_data(f: &amp;mut std::fs::File) {
      let mut reader = BufReader::new(f);
      read_some_other_data(&amp;mut reader);
  }
  </code></pre>
  <p>While this can be made to work, which permutation of reference access should be used when passing the reader around to other functions?</p>
  <ul>
  <li><code>&amp;mut BufReader&lt;&amp;mut File&gt;</code></li>
  <li><code>BufReader&lt;&amp;mut File&gt;</code></li>
  <li><code>&amp;mut BufReader&lt;File&gt;</code></li>
  <li><code>BufReader&lt;File&gt;</code></li>
  </ul>
  <p>Since there is no need for each function to own the data I was thinking it would be best to pass as <code>&amp;mut BufReader&lt;&amp;mut File&gt;</code>, but the example in the docs uses <code>&lt;File&gt;</code>.</p>
  <p>Whats a good rule of thumb to use here?</p>
  <p>While this example uses <code>BufReader</code>, I assume the same answer would apply to <code>BufWriter</code> too.</p>