title: Slicing XML strings in a safe, Rust way
body: <p>I'm working on parsing XML, and we discovered that the XML parser spent a lot of time needlessly checking for UTF compatibility. For example, let's say I'm parsing something akin to:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;&lt;ß❤&gt;&lt;/ß❤&gt;&lt;/root&gt;
  </code></pre>
  
  <p>In our flamegraphs, we'd spend a lot of time checking whether <code>root</code> or <code>ß❤</code> was valid UTF.</p>
  
  <p>One way to avoid this check is to have a precondition that XML input is valid Rust <code>&amp;str</code>. Since it is and the delimiters are ASCII based, in theory, slicing between any two ASCII delimiters should yield valid &amp;str, which we won't check.</p>
  
  <p>Is this a safe assumption? Or even better, is there a crate that does something similar (e.g. <code>CSV</code>)?</p>