mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 18:32:15 +00:00
89 lines
44 KiB
HTML
89 lines
44 KiB
HTML
<!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">☰</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'>−</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><'a>(&'a self, is_extended: bool) -> <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.grapheme_indices' class='fnname'>grapheme_indices</a><'a>(&'a self, is_extended: bool) -> <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.unicode_words' class='fnname'>unicode_words</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.split_word_bounds' class='fnname'>split_word_bounds</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.split_word_bound_indices' class='fnname'>split_word_bound_indices</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.unicode_sentences' class='fnname'>unicode_sentences</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.split_sentence_bounds' class='fnname'>split_sentence_bounds</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a><'a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.split_sentence_bound_indices' class='fnname'>split_sentence_bound_indices</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a><'a>;
|
||
}</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='graphemes.v'>fn <a href='#tymethod.graphemes' class='fnname'>graphemes</a><'a>(&'a self, is_extended: bool) -> <a class="struct" href="../unicode_segmentation/struct.Graphemes.html" title="struct unicode_segmentation::Graphemes">Graphemes</a><'a></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">"a\u{310}e\u{301}o\u{308}\u{332}"</span>, <span class="bool-val">true</span>)
|
||
.<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">str</span><span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[<span class="string">"a\u{310}"</span>, <span class="string">"e\u{301}"</span>, <span class="string">"o\u{308}\u{332}"</span>];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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">"a\r\nb🇷🇺🇸🇹"</span>, <span class="bool-val">true</span>).<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">str</span><span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[<span class="string">"a"</span>, <span class="string">"\r\n"</span>, <span class="string">"b"</span>, <span class="string">"🇷🇺"</span>, <span class="string">"🇸🇹"</span>];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'a str);</span></code></div></div><code id='grapheme_indices.v'>fn <a href='#tymethod.grapheme_indices' class='fnname'>grapheme_indices</a><'a>(&'a self, is_extended: bool) -> <a class="struct" href="../unicode_segmentation/struct.GraphemeIndices.html" title="struct unicode_segmentation::GraphemeIndices">GraphemeIndices</a><'a></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">"a̐éö̲\r\n"</span>, <span class="bool-val">true</span>)
|
||
.<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span>(<span class="ident">usize</span>, <span class="kw-2">&</span><span class="ident">str</span>)<span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[(<span class="number">0</span>, <span class="string">"a̐"</span>), (<span class="number">3</span>, <span class="string">"é"</span>), (<span class="number">6</span>, <span class="string">"ö̲"</span>), (<span class="number">11</span>, <span class="string">"\r\n"</span>)];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='unicode_words.v'>fn <a href='#tymethod.unicode_words' class='fnname'>unicode_words</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a><'a></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, "words" 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">"The quick (\"brown\") fox can't jump 32.3 feet, right?"</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"><</span><span class="ident">Vec</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">str</span><span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[<span class="string">"The"</span>, <span class="string">"quick"</span>, <span class="string">"brown"</span>, <span class="string">"fox"</span>, <span class="string">"can't"</span>, <span class="string">"jump"</span>, <span class="string">"32.3"</span>, <span class="string">"feet"</span>, <span class="string">"right"</span>];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'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><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a><'a></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">"The quick (\"brown\") fox"</span>.<span class="ident">split_word_bounds</span>().<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">str</span><span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[<span class="string">"The"</span>, <span class="string">" "</span>, <span class="string">"quick"</span>, <span class="string">" "</span>, <span class="string">"("</span>, <span class="string">"\""</span>, <span class="string">"brown"</span>, <span class="string">"\""</span>, <span class="string">")"</span>, <span class="string">" "</span>, <span class="string">" "</span>, <span class="string">"fox"</span>];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'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><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a><'a></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">"Brr, it's 29.3°F!"</span>.<span class="ident">split_word_bound_indices</span>().<span class="ident">collect</span>::<span class="op"><</span><span class="ident">Vec</span><span class="op"><</span>(<span class="ident">usize</span>, <span class="kw-2">&</span><span class="ident">str</span>)<span class="op">></span><span class="op">></span>();
|
||
<span class="kw">let</span> <span class="ident">b</span>: <span class="kw-2">&</span>[<span class="kw">_</span>] <span class="op">=</span> <span class="kw-2">&</span>[(<span class="number">0</span>, <span class="string">"Brr"</span>), (<span class="number">3</span>, <span class="string">","</span>), (<span class="number">4</span>, <span class="string">" "</span>), (<span class="number">5</span>, <span class="string">"it's"</span>), (<span class="number">9</span>, <span class="string">" "</span>), (<span class="number">10</span>, <span class="string">"29.3"</span>),
|
||
(<span class="number">14</span>, <span class="string">"°"</span>), (<span class="number">16</span>, <span class="string">"F"</span>), (<span class="number">17</span>, <span class="string">"!"</span>)];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='unicode_sentences.v'>fn <a href='#tymethod.unicode_sentences' class='fnname'>unicode_sentences</a><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a><'a></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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'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><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a><'a></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, "sentences" 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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'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><'a>(&'a self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a><'a></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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='graphemes.v-1'>fn <a href='#method.graphemes' class='fnname'>graphemes</a>(&self, is_extended: bool) -> <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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'a str);</span></code></div></div><code id='grapheme_indices.v-1'>fn <a href='#method.grapheme_indices' class='fnname'>grapheme_indices</a>(&self, is_extended: bool) -> <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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='unicode_words.v-1'>fn <a href='#method.unicode_words' class='fnname'>unicode_words</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeWords.html" title="struct unicode_segmentation::UnicodeWords">UnicodeWords</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#214-216' title='goto source code'>[src]</a></h4><h4 id='method.split_word_bounds' class="method hidden"><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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='split_word_bounds.v-1'>fn <a href='#method.split_word_bounds' class='fnname'>split_word_bounds</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBounds.html" title="struct unicode_segmentation::UWordBounds">UWordBounds</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#219-221' title='goto source code'>[src]</a></h4><h4 id='method.split_word_bound_indices' class="method hidden"><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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'a str);</span></code></div></div><code id='split_word_bound_indices.v-1'>fn <a href='#method.split_word_bound_indices' class='fnname'>split_word_bound_indices</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.UWordBoundIndices.html" title="struct unicode_segmentation::UWordBoundIndices">UWordBoundIndices</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#224-226' title='goto source code'>[src]</a></h4><h4 id='method.unicode_sentences' class="method hidden"><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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='unicode_sentences.v-1'>fn <a href='#method.unicode_sentences' class='fnname'>unicode_sentences</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.UnicodeSentences.html" title="struct unicode_segmentation::UnicodeSentences">UnicodeSentences</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#229-231' title='goto source code'>[src]</a></h4><h4 id='method.split_sentence_bounds' class="method hidden"><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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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> = &'a str;</span></code></div></div><code id='split_sentence_bounds.v-1'>fn <a href='#method.split_sentence_bounds' class='fnname'>split_sentence_bounds</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBounds.html" title="struct unicode_segmentation::USentenceBounds">USentenceBounds</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#234-236' title='goto source code'>[src]</a></h4><h4 id='method.split_sentence_bound_indices' class="method hidden"><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><'a></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><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <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><'a></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, &'a str);</span></code></div></div><code id='split_sentence_bound_indices.v-1'>fn <a href='#method.split_sentence_bound_indices' class='fnname'>split_sentence_bound_indices</a>(&self) -> <a class="struct" href="../unicode_segmentation/struct.USentenceBoundIndices.html" title="struct unicode_segmentation::USentenceBoundIndices">USentenceBoundIndices</a></code><a class='srclink' href='../src/unicode_segmentation/lib.rs.html#239-241' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
||
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>⏎</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> |