title: How to get the size of an already-opened File in Rust?
body: <p>How can I get the size/length of the file that is declared as a <code>File</code> variable?</p>
  
  <p>There is an option for getting it using the file name via <code>fs::metadata</code>:</p>
  
  <pre><code>let x = fs::metadata(file_path)?.len();
  </code></pre>
  
  <p>But I have a file that I already created and edited:</p>
  
  <pre><code>let mut my_file = File::create(file_path).unwrap();
  my_file.write_all(buffer) // buffer is a data which comes from network and put into Vec&lt;u8&gt;
  
  // From here, does it possible to get my_file length?
  // Looking something like my_file.len();
  </code></pre>
  
  <p>Are there any function that gives the length of the <code>File</code>?</p>