title: How do I check if a character is a Unicode new-line character (not only ASCII) in Rust?
body: <p>Every programming language has their own interpretation of <code>\n</code> and <code>\r</code>. 
  Unicode supports multiple characters that <em>can</em> represent a new line.</p>
  
  <p>From <a href="https://doc.rust-lang.org/stable/reference/tokens.html#character-escapes" rel="noreferrer">the Rust reference</a>:</p>
  
  <blockquote>
    <p>A whitespace escape is one of the characters U+006E (n), U+0072 (r),
    or U+0074 (t), denoting the Unicode values U+000A (LF), U+000D (CR) or
    U+0009 (HT) respectively.</p>
  </blockquote>
  
  <p>Based on that statement, I'd say a Rust character is a new-line character if it is either <code>\n</code> or <code>\r</code>. On Windows it might be the combination of <code>\r</code> and <code>\n</code>. I'm not sure though.</p>
  
  <p>What about the following?</p>
  
  <ul>
  <li>Next line character (U+0085)</li>
  <li>Line separator character (U+2028)</li>
  <li>Paragraph separator character (U+2029)</li>
  </ul>
  
  <p>In my opinion, we are missing something like a <code>char.is_new_line()</code>. 
  I looked through the <a href="http://www.fileformat.info/info/unicode/category/index.htm" rel="noreferrer">Unicode Character Categories</a> but couldn't find a definition for new-lines.</p>
  
  <p>Do I have to come up with my own definition of what a Unicode new-line character is?</p>