title: How to copy or borrow a reference to, an owned String inside an owned Vec?
body: <p>I'm trying to first set a <code>String</code> to be some default, but then update that <code>String</code> if a command line argument has been given...</p>
  
  <p>This is my starting point (which doesn't compile):</p>
  
  <pre><code>use std::env;
  
  fn main() {
      let mut config_file = "C:\\temp\\rust\\config.txt".to_string();
      let args: Vec&lt;String&gt; = env::args().collect();
      if args.len() &gt; 1 {
          config_file = args[1];
      }
      println!("Config file path: {}", config_file);
  }
  </code></pre>
  
  <p>So, (I think) <code>env::args()</code> is giving me an owned vector or owned strings... How do I either:</p>
  
  <ul>
  <li>Copy a string in the vector</li>
  <li>Get a reference to a string in the vector</li>
  </ul>
  
  <p>Note:</p>
  
  <pre><code>$ rustc --version
  rustc 1.8.0 (db2939409 2016-04-11)
  </code></pre>