wasmer/rustdoc/unicode_segmentation/trait.UnicodeSegmentation.html

89 lines
44 KiB
HTML
Raw Normal View History

2019-09-06 15:57:44 -07:00
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `UnicodeSegmentation` trait in crate `unicode_segmentation`."><meta name="keywords" content="rust, rustlang, rust-lang, UnicodeSegmentation"><title>unicode_segmentation::UnicodeSegmentation - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://unicode-rs.github.io/unicode-rs_sm.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../unicode_segmentation/index.html'><div class='logo-container'><img src='https://unicode-rs.github.io/unicode-rs_sm.png' alt='logo'></div></a><p class='location'>Trait UnicodeSegmentation</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.grapheme_indices">grapheme_indices</a><a href="#tymethod.graphemes">graphemes</a><a href="#tymethod.split_sentence_bound_indices">split_sentence_bound_indices</a><a href="#tymethod.split_sentence_bounds">split_sentence_bounds</a><a href="#tymethod.split_word_bound_indices">split_word_bound_indices</a><a href="#tymethod.split_word_bounds">split_word_bounds</a><a href="#tymethod.unicode_sentences">unicode_sentences</a><a href="#tymethod.unicode_words">unicode_words</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>unicode_segmentation</a></p><script>window.sidebarCurrent = {name: 'UnicodeSegmentation', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#84-200' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>unicode_segmentation</a>::<wbr><a class="trait" href=''>UnicodeSegmentation</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait UnicodeSegmentation {
fn <a href='#tymethod.graphemes' class='fnname'>graphemes</a>&lt;'a&gt;(&amp;'a self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.grapheme_indices' class='fnname'>grapheme_indices</a>&lt;'a&gt;(&amp;'a self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.unicode_words' class='fnname'>unicode_words</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.split_word_bounds' class='fnname'>split_word_bounds</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.split_word_bound_indices' class='fnname'>split_word_bound_indices</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.unicode_sentences' class='fnname'>unicode_sentences</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.split_sentence_bounds' class='fnname'>split_sentence_bounds</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a>&lt;'a&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.split_sentence_bound_indices' class='fnname'>split_sentence_bound_indices</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a>&lt;'a&gt;;
}</pre></div><div class='docblock'><p>Methods for segmenting strings according to
<a href="http://www.unicode.org/reports/tr29/">Unicode Standard Annex #29</a>.</p>
</div>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.graphemes' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='graphemes.v'>fn <a href='#tymethod.graphemes' class='fnname'>graphemes</a>&lt;'a&gt;(&amp;'a self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over the <a href="http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries">grapheme clusters</a> of <code>self</code>.</p>
<p>If <code>is_extended</code> is true, the iterator is over the
<em>extended grapheme clusters</em>;
otherwise, the iterator is over the <em>legacy grapheme clusters</em>.
<a href="http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries">UAX#29</a>
recommends extended grapheme cluster boundaries for general processing.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">gr1</span> <span class="op">=</span> <span class="ident">UnicodeSegmentation</span>::<span class="ident">graphemes</span>(<span class="string">&quot;a\u{310}e\u{301}o\u{308}\u{332}&quot;</span>, <span class="bool-val">true</span>)
.<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="string">&quot;a\u{310}&quot;</span>, <span class="string">&quot;e\u{301}&quot;</span>, <span class="string">&quot;o\u{308}\u{332}&quot;</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">gr1</span>[..], <span class="ident">b</span>);
<span class="kw">let</span> <span class="ident">gr2</span> <span class="op">=</span> <span class="ident">UnicodeSegmentation</span>::<span class="ident">graphemes</span>(<span class="string">&quot;a\r\nb🇷🇺🇸🇹&quot;</span>, <span class="bool-val">true</span>).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="string">&quot;a&quot;</span>, <span class="string">&quot;\r\n&quot;</span>, <span class="string">&quot;b&quot;</span>, <span class="string">&quot;🇷🇺&quot;</span>, <span class="string">&quot;🇸🇹&quot;</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">gr2</span>[..], <span class="ident">b</span>);</pre></div>
</div><h3 id='tymethod.grapheme_indices' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = (usize, &amp;'a str);</span></code></div></div><code id='grapheme_indices.v'>fn <a href='#tymethod.grapheme_indices' class='fnname'>grapheme_indices</a>&lt;'a&gt;(&amp;'a self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over the grapheme clusters of <code>self</code> and their
byte offsets. See <code>graphemes()</code> for more information.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">gr_inds</span> <span class="op">=</span> <span class="ident">UnicodeSegmentation</span>::<span class="ident">grapheme_indices</span>(<span class="string">&quot;a̐éö̲\r\n&quot;</span>, <span class="bool-val">true</span>)
.<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">usize</span>, <span class="kw-2">&amp;</span><span class="ident">str</span>)<span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[(<span class="number">0</span>, <span class="string">&quot;&quot;</span>), (<span class="number">3</span>, <span class="string">&quot;&quot;</span>), (<span class="number">6</span>, <span class="string">&quot;ö̲&quot;</span>), (<span class="number">11</span>, <span class="string">&quot;\r\n&quot;</span>)];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">gr_inds</span>[..], <span class="ident">b</span>);</pre></div>
</div><h3 id='tymethod.unicode_words' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='unicode_words.v'>fn <a href='#tymethod.unicode_words' class='fnname'>unicode_words</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over the words of <code>self</code>, separated on
<a href="http://www.unicode.org/reports/tr29/#Word_Boundaries">UAX#29 word boundaries</a>.</p>
<p>Here, &quot;words&quot; are just those substrings which, after splitting on
UAX#29 word boundaries, contain any alphanumeric characters. That is, the
substring must contain at least one character with the
<a href="http://unicode.org/reports/tr44/#Alphabetic">Alphabetic</a>
property, or with
<a href="http://unicode.org/reports/tr44/#General_Category_Values">General_Category=Number</a>.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">uws</span> <span class="op">=</span> <span class="string">&quot;The quick (\&quot;brown\&quot;) fox can&#39;t jump 32.3 feet, right?&quot;</span>;
<span class="kw">let</span> <span class="ident">uw1</span> <span class="op">=</span> <span class="ident">uws</span>.<span class="ident">unicode_words</span>().<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="string">&quot;The&quot;</span>, <span class="string">&quot;quick&quot;</span>, <span class="string">&quot;brown&quot;</span>, <span class="string">&quot;fox&quot;</span>, <span class="string">&quot;can&#39;t&quot;</span>, <span class="string">&quot;jump&quot;</span>, <span class="string">&quot;32.3&quot;</span>, <span class="string">&quot;feet&quot;</span>, <span class="string">&quot;right&quot;</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">uw1</span>[..], <span class="ident">b</span>);</pre></div>
</div><h3 id='tymethod.split_word_bounds' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='split_word_bounds.v'>fn <a href='#tymethod.split_word_bounds' class='fnname'>split_word_bounds</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over substrings of <code>self</code> separated on
<a href="http://www.unicode.org/reports/tr29/#Word_Boundaries">UAX#29 word boundaries</a>.</p>
<p>The concatenation of the substrings returned by this function is just the original string.</p>
<h1 id="example-1" class="section-header"><a href="#example-1">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">swu1</span> <span class="op">=</span> <span class="string">&quot;The quick (\&quot;brown\&quot;) fox&quot;</span>.<span class="ident">split_word_bounds</span>().<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="string">&quot;The&quot;</span>, <span class="string">&quot; &quot;</span>, <span class="string">&quot;quick&quot;</span>, <span class="string">&quot; &quot;</span>, <span class="string">&quot;(&quot;</span>, <span class="string">&quot;\&quot;&quot;</span>, <span class="string">&quot;brown&quot;</span>, <span class="string">&quot;\&quot;&quot;</span>, <span class="string">&quot;)&quot;</span>, <span class="string">&quot; &quot;</span>, <span class="string">&quot; &quot;</span>, <span class="string">&quot;fox&quot;</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">swu1</span>[..], <span class="ident">b</span>);</pre></div>
</div><h3 id='tymethod.split_word_bound_indices' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = (usize, &amp;'a str);</span></code></div></div><code id='split_word_bound_indices.v'>fn <a href='#tymethod.split_word_bound_indices' class='fnname'>split_word_bound_indices</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over substrings of <code>self</code>, split on UAX#29 word boundaries,
and their offsets. See <code>split_word_bounds()</code> for more information.</p>
<h1 id="example-2" class="section-header"><a href="#example-2">Example</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">swi1</span> <span class="op">=</span> <span class="string">&quot;Brr, it&#39;s 29.3°F!&quot;</span>.<span class="ident">split_word_bound_indices</span>().<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">usize</span>, <span class="kw-2">&amp;</span><span class="ident">str</span>)<span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&amp;</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[(<span class="number">0</span>, <span class="string">&quot;Brr&quot;</span>), (<span class="number">3</span>, <span class="string">&quot;,&quot;</span>), (<span class="number">4</span>, <span class="string">&quot; &quot;</span>), (<span class="number">5</span>, <span class="string">&quot;it&#39;s&quot;</span>), (<span class="number">9</span>, <span class="string">&quot; &quot;</span>), (<span class="number">10</span>, <span class="string">&quot;29.3&quot;</span>),
(<span class="number">14</span>, <span class="string">&quot;°&quot;</span>), (<span class="number">16</span>, <span class="string">&quot;F&quot;</span>), (<span class="number">17</span>, <span class="string">&quot;!&quot;</span>)];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&amp;</span><span class="ident">swi1</span>[..], <span class="ident">b</span>);</pre></div>
</div><h3 id='tymethod.unicode_sentences' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='unicode_sentences.v'>fn <a href='#tymethod.unicode_sentences' class='fnname'>unicode_sentences</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over substrings of <code>self</code> separated on
<a href="http://www.unicode.org/reports/tr29/#Sentence_Boundaries">UAX#29 sentence boundaries</a>.</p>
<p>The concatenation of the substrings returned by this function is just the original string.</p>
</div><h3 id='tymethod.split_sentence_bounds' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='split_sentence_bounds.v'>fn <a href='#tymethod.split_sentence_bounds' class='fnname'>split_sentence_bounds</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over substrings of <code>self</code> separated on
<a href="http://www.unicode.org/reports/tr29/#Sentence_Boundaries">UAX#29 sentence boundaries</a>.</p>
<p>Here, &quot;sentences&quot; are just those substrings which, after splitting on
UAX#29 sentence boundaries, contain any alphanumeric characters. That is, the
substring must contain at least one character with the
<a href="http://unicode.org/reports/tr44/#Alphabetic">Alphabetic</a>
property, or with
<a href="http://unicode.org/reports/tr44/#General_Category_Values">General_Category=Number</a>.</p>
</div><h3 id='tymethod.split_sentence_bound_indices' class='method'><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = (usize, &amp;'a str);</span></code></div></div><code id='split_sentence_bound_indices.v'>fn <a href='#tymethod.split_sentence_bound_indices' class='fnname'>split_sentence_bound_indices</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a>&lt;'a&gt;</code></h3><div class='docblock'><p>Returns an iterator over substrings of <code>self</code>, split on UAX#29 sentence boundaries,
and their offsets. See <code>split_sentence_bounds()</code> for more information.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-UnicodeSegmentation' class='impl'><code class='in-band'>impl UnicodeSegmentation for str</code><a href='#impl-UnicodeSegmentation' class='anchor'></a><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#202-242' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.graphemes' class="method hidden"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a str;</span></code></div></div><code id='graphemes.v-1'>fn <a href='#method.graphemes' class='fnname'>graphemes</a>(&amp;self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#204-206' title='goto source code'>[src]</a></h4><h4 id='method.grapheme_indices' class="method hidden"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a> for <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a>&lt;'a&gt;</span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = (usize, &amp;'a str);</span></code></div></div><code id='grapheme_indices.v-1'>fn <a href='#method.grapheme_indices' class='fnname'>grapheme_indices</a>(&amp;self, is_extended: bool) -&gt; <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#209-211' title='goto source code'>[src]</a></h4><h4 id='method.unicode_words' class="method hidden"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a>&lt;'a&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</
src="../implementors/unicode_segmentation/trait.UnicodeSegmentation.js">
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "unicode_segmentation";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>