title: What does the "two periods" operator mean in the context of a subscript inside of square brackets?
body: <p>I was looking through Rust's source code to better acquaint myself with the language. I came across this snippet.</p>
  
  <pre><code>// Collect program arguments as a Vec&lt;String&gt;.
  let cmd: Vec&lt;_&gt; = env::args().collect();
  
  // Some unrelated code omitted here.
  
  match subcommand::parse_name(&amp;cmd[1][..]) {
      // It did some stuff here.
  }
  </code></pre>
  
  <p>I didn't understand the <code>[..]</code>. So, I went and checked out the declaration of <code>parse_name</code>:</p>
  
  <pre><code>pub fn parse_name(name: &amp;str) -&gt; Option&lt;Box&lt;Subcommand&gt;&gt;
  </code></pre>
  
  <p>It's what I expected, but I still don't get the <code>[..]</code>. What does it mean in this context? Isn't it just passing the first <code>String</code> in <code>cmd</code> as a <code>&amp;str</code>? If so, is this equivalent to just writing <code>cmd[1]</code>? Why did they do it this way?</p>