460 lines
No EOL
47 KiB
HTML
460 lines
No EOL
47 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 `CharClass` struct in crate `regex_syntax`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, CharClass">
|
||
|
||
<title>regex_syntax::CharClass - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='index.html'>regex_syntax</a></p><script>window.sidebarCurrent = {name: 'CharClass', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>regex_syntax</a>::<wbr><a class='struct' href=''>CharClass</a></span><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 id='src-1378' class='srclink' href='../src/regex_syntax/lib.rs.html#239-241' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct CharClass {
|
||
// some fields omitted
|
||
}</pre><div class='docblock'><p>A character class.</p>
|
||
|
||
<p>A character class has a canonical format that the parser guarantees. Its
|
||
canonical format is defined by the following invariants:</p>
|
||
|
||
<ol>
|
||
<li>Given any Unicode scalar value, it is matched by <em>at most</em> one character
|
||
range in a canonical character class.</li>
|
||
<li>Every adjacent character range is separated by at least one Unicode
|
||
scalar value.</li>
|
||
<li>Given any pair of character ranges <code>r1</code> and <code>r2</code>, if
|
||
<code>r1.end < r2.start</code>, then <code>r1</code> comes before <code>r2</code> in a canonical
|
||
character class.</li>
|
||
</ol>
|
||
|
||
<p>In sum, any <code>CharClass</code> produced by this crate's parser is a sorted
|
||
sequence of non-overlapping ranges. This makes it possible to test whether
|
||
a character is matched by a class with a binary search.</p>
|
||
|
||
<p>If the case insensitive flag was set when parsing a character class, then
|
||
simple case folding is done automatically. For example, <code>(?i)[a-c]</code> is
|
||
automatically translated to <code>[a-cA-C]</code>.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(ranges: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>>) -> <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h4>
|
||
<div class='docblock'><p>Create a new class from an existing set of ranges.</p>
|
||
</div><h4 id='method.matches' class='method'><code>fn <a href='#method.matches' class='fnname'>matches</a>(&self, c: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||
<div class='docblock'><p>Returns true if <code>c</code> is matched by this character class.</p>
|
||
</div><h4 id='method.remove' class='method'><code>fn <a href='#method.remove' class='fnname'>remove</a>(&mut self, c: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>)</code></h4>
|
||
<div class='docblock'><p>Removes the given character from the class if it exists.</p>
|
||
|
||
<p>Note that this takes <code>O(n)</code> time in the number of ranges.</p>
|
||
</div><h4 id='method.negate' class='method'><code>fn <a href='#method.negate' class='fnname'>negate</a>(self) -> <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h4>
|
||
<div class='docblock'><p>Negates the character class.</p>
|
||
|
||
<p>For all <code>c</code> where <code>c</code> is a Unicode scalar value, <code>c</code> matches <code>self</code>
|
||
if and only if <code>c</code> does not match <code>self.negate()</code>.</p>
|
||
</div><h4 id='method.case_fold' class='method'><code>fn <a href='#method.case_fold' class='fnname'>case_fold</a>(self) -> <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h4>
|
||
<div class='docblock'><p>Apply case folding to this character class.</p>
|
||
|
||
<p>N.B. Applying case folding to a negated character class probably
|
||
won't produce the expected result. e.g., <code>(?i)[^x]</code> really should
|
||
match any character sans <code>x</code> and <code>X</code>, but if <code>[^x]</code> is negated
|
||
before being case folded, you'll end up matching any character.</p>
|
||
</div></div><h2 id='deref-methods'>Methods from <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html' title='core::ops::Deref'>Deref</a><Target=<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>>></h2><div class='impl-items'><h4 id='method.capacity' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.capacity' class='fnname'>capacity</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code></h4>
|
||
<div class='docblock'><p>Returns the number of elements the vector can hold without
|
||
reallocating.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>vec</span>: <span class='ident'>Vec</span><span class='op'><</span><span class='ident'>i32</span><span class='op'>></span> <span class='op'>=</span> <span class='ident'>Vec</span>::<span class='ident'>with_capacity</span>(<span class='number'>10</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>capacity</span>(), <span class='number'>10</span>);</pre>
|
||
</div><h4 id='method.reserve' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.reserve' class='fnname'>reserve</a>(&mut self, additional: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>)</code></h4>
|
||
<div class='docblock'><p>Reserves capacity for at least <code>additional</code> more elements to be inserted
|
||
in the given <code>Vec<T></code>. The collection may reserve more space to avoid
|
||
frequent reallocations.</p>
|
||
|
||
<h1 id='panics' class='section-header'><a href='#panics'>Panics</a></h1>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
|
||
<h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>reserve</span>(<span class='number'>10</span>);
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>capacity</span>() <span class='op'>>=</span> <span class='number'>11</span>);</pre>
|
||
</div><h4 id='method.reserve_exact' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.reserve_exact' class='fnname'>reserve_exact</a>(&mut self, additional: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>)</code></h4>
|
||
<div class='docblock'><p>Reserves the minimum capacity for exactly <code>additional</code> more elements to
|
||
be inserted in the given <code>Vec<T></code>. Does nothing if the capacity is already
|
||
sufficient.</p>
|
||
|
||
<p>Note that the allocator may give the collection more space than it
|
||
requests. Therefore capacity can not be relied upon to be precisely
|
||
minimal. Prefer <code>reserve</code> if future insertions are expected.</p>
|
||
|
||
<h1 id='panics-1' class='section-header'><a href='#panics-1'>Panics</a></h1>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
|
||
<h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>reserve_exact</span>(<span class='number'>10</span>);
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>capacity</span>() <span class='op'>>=</span> <span class='number'>11</span>);</pre>
|
||
</div><h4 id='method.shrink_to_fit' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.shrink_to_fit' class='fnname'>shrink_to_fit</a>(&mut self)</code></h4>
|
||
<div class='docblock'><p>Shrinks the capacity of the vector as much as possible.</p>
|
||
|
||
<p>It will drop down as close as possible to the length but the allocator
|
||
may still inform the vector that there is space for a few more elements.</p>
|
||
|
||
<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='ident'>Vec</span>::<span class='ident'>with_capacity</span>(<span class='number'>10</span>);
|
||
<span class='ident'>vec</span>.<span class='ident'>extend</span>([<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>].<span class='ident'>iter</span>().<span class='ident'>cloned</span>());
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>capacity</span>(), <span class='number'>10</span>);
|
||
<span class='ident'>vec</span>.<span class='ident'>shrink_to_fit</span>();
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>capacity</span>() <span class='op'>>=</span> <span class='number'>3</span>);</pre>
|
||
</div><h4 id='method.into_boxed_slice' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.into_boxed_slice' class='fnname'>into_boxed_slice</a>(self) -> <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>[</a>T<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>></code></h4>
|
||
<div class='docblock'><p>Converts the vector into Box<[T]>.</p>
|
||
|
||
<p>Note that this will drop any excess capacity. Calling this and
|
||
converting back to a vector with <code>into_vec()</code> is equivalent to calling
|
||
<code>shrink_to_fit()</code>.</p>
|
||
</div><h4 id='method.truncate' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.truncate' class='fnname'>truncate</a>(&mut self, len: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>)</code></h4>
|
||
<div class='docblock'><p>Shorten a vector to be <code>len</code> elements long, dropping excess elements.</p>
|
||
|
||
<p>If <code>len</code> is greater than the vector's current length, this has no
|
||
effect.</p>
|
||
|
||
<h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>, <span class='number'>5</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>truncate</span>(<span class='number'>2</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>]);</pre>
|
||
</div><h4 id='method.as_slice' class='method'><span class="since">1.7.0</span><code>fn <a href='#method.as_slice' class='fnname'>as_slice</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&[T]</a></code></h4>
|
||
<div class='docblock'><p>Extracts a slice containing the entire vector.</p>
|
||
|
||
<p>Equivalent to <code>&s[..]</code>.</p>
|
||
</div><h4 id='method.as_mut_slice' class='method'><span class="since">1.7.0</span><code>fn <a href='#method.as_mut_slice' class='fnname'>as_mut_slice</a>(&mut self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [T]</a></code></h4>
|
||
<div class='docblock'><p>Extracts a mutable slice of the entire vector.</p>
|
||
|
||
<p>Equivalent to <code>&mut s[..]</code>.</p>
|
||
</div><h4 id='method.set_len' class='method'><span class="since">1.0.0</span><code>unsafe fn <a href='#method.set_len' class='fnname'>set_len</a>(&mut self, len: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>)</code></h4>
|
||
<div class='docblock'><p>Sets the length of a vector.</p>
|
||
|
||
<p>This will explicitly set the size of the vector, without actually
|
||
modifying its buffers, so it is up to the caller to ensure that the
|
||
vector is actually the specified size.</p>
|
||
|
||
<h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>];
|
||
<span class='kw'>unsafe</span> {
|
||
<span class='ident'>v</span>.<span class='ident'>set_len</span>(<span class='number'>1</span>);
|
||
}</pre>
|
||
</div><h4 id='method.swap_remove' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.swap_remove' class='fnname'>swap_remove</a>(&mut self, index: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> T</code></h4>
|
||
<div class='docblock'><p>Removes an element from anywhere in the vector and return it, replacing
|
||
it with the last element.</p>
|
||
|
||
<p>This does not preserve ordering, but is O(1).</p>
|
||
|
||
<h1 id='panics-2' class='section-header'><a href='#panics-2'>Panics</a></h1>
|
||
<p>Panics if <code>index</code> is out of bounds.</p>
|
||
|
||
<h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"foo"</span>, <span class='string'>"bar"</span>, <span class='string'>"baz"</span>, <span class='string'>"qux"</span>];
|
||
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>.<span class='ident'>swap_remove</span>(<span class='number'>1</span>), <span class='string'>"bar"</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>, [<span class='string'>"foo"</span>, <span class='string'>"qux"</span>, <span class='string'>"baz"</span>]);
|
||
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>.<span class='ident'>swap_remove</span>(<span class='number'>0</span>), <span class='string'>"foo"</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>, [<span class='string'>"baz"</span>, <span class='string'>"qux"</span>]);</pre>
|
||
</div><h4 id='method.insert' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.insert' class='fnname'>insert</a>(&mut self, index: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>, element: T)</code></h4>
|
||
<div class='docblock'><p>Inserts an element at position <code>index</code> within the vector, shifting all
|
||
elements after it to the right.</p>
|
||
|
||
<h1 id='panics-3' class='section-header'><a href='#panics-3'>Panics</a></h1>
|
||
<p>Panics if <code>index</code> is greater than the vector's length.</p>
|
||
|
||
<h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>insert</span>(<span class='number'>1</span>, <span class='number'>4</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>4</span>, <span class='number'>2</span>, <span class='number'>3</span>]);
|
||
<span class='ident'>vec</span>.<span class='ident'>insert</span>(<span class='number'>4</span>, <span class='number'>5</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>4</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>5</span>]);</pre>
|
||
</div><h4 id='method.remove-1' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.remove' class='fnname'>remove</a>(&mut self, index: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> T</code></h4>
|
||
<div class='docblock'><p>Removes and returns the element at position <code>index</code> within the vector,
|
||
shifting all elements after it to the left.</p>
|
||
|
||
<h1 id='panics-4' class='section-header'><a href='#panics-4'>Panics</a></h1>
|
||
<p>Panics if <code>index</code> is out of bounds.</p>
|
||
|
||
<h1 id='examples-8' class='section-header'><a href='#examples-8'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>.<span class='ident'>remove</span>(<span class='number'>1</span>), <span class='number'>2</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>, [<span class='number'>1</span>, <span class='number'>3</span>]);</pre>
|
||
</div><h4 id='method.retain' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.retain' class='fnname'>retain</a><F>(&mut self, f: F) <span class='where'>where F: <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.FnMut.html' title='core::ops::FnMut'>FnMut</a>(&T) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></span></code></h4>
|
||
<div class='docblock'><p>Retains only the elements specified by the predicate.</p>
|
||
|
||
<p>In other words, remove all elements <code>e</code> such that <code>f(&e)</code> returns false.
|
||
This method operates in place and preserves the order of the retained
|
||
elements.</p>
|
||
|
||
<h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>retain</span>(<span class='op'>|</span><span class='kw-2'>&</span><span class='ident'>x</span><span class='op'>|</span> <span class='ident'>x</span><span class='op'>%</span><span class='number'>2</span> <span class='op'>==</span> <span class='number'>0</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>2</span>, <span class='number'>4</span>]);</pre>
|
||
</div><h4 id='method.push' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.push' class='fnname'>push</a>(&mut self, value: T)</code></h4>
|
||
<div class='docblock'><p>Appends an element to the back of a collection.</p>
|
||
|
||
<h1 id='panics-5' class='section-header'><a href='#panics-5'>Panics</a></h1>
|
||
<p>Panics if the number of elements in the vector overflows a <code>usize</code>.</p>
|
||
|
||
<h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>push</span>(<span class='number'>3</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>]);</pre>
|
||
</div><h4 id='method.pop' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.pop' class='fnname'>pop</a>(&mut self) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><T></code></h4>
|
||
<div class='docblock'><p>Removes the last element from a vector and returns it, or <code>None</code> if it
|
||
is empty.</p>
|
||
|
||
<h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>.<span class='ident'>pop</span>(), <span class='prelude-val'>Some</span>(<span class='number'>3</span>));
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>]);</pre>
|
||
</div><h4 id='method.append' class='method'><span class="since">1.4.0</span><code>fn <a href='#method.append' class='fnname'>append</a>(&mut self, other: &mut <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><T>)</code></h4>
|
||
<div class='docblock'><p>Moves all the elements of <code>other</code> into <code>Self</code>, leaving <code>other</code> empty.</p>
|
||
|
||
<h1 id='panics-6' class='section-header'><a href='#panics-6'>Panics</a></h1>
|
||
<p>Panics if the number of elements in the vector overflows a <code>usize</code>.</p>
|
||
|
||
<h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec2</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>4</span>, <span class='number'>5</span>, <span class='number'>6</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>append</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>vec2</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>, <span class='number'>5</span>, <span class='number'>6</span>]);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec2</span>, []);</pre>
|
||
</div><h4 id='method.drain' class='method'><span class="since">1.6.0</span><code>fn <a href='#method.drain' class='fnname'>drain</a><R>(&mut self, range: R) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Drain.html' title='collections::vec::Drain'>Drain</a><T> <span class='where'>where R: <a class='trait' href='https://doc.rust-lang.org/nightly/collections/range/trait.RangeArgument.html' title='collections::range::RangeArgument'>RangeArgument</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>></span></code></h4>
|
||
<div class='docblock'><p>Create a draining iterator that removes the specified range in the vector
|
||
and yields the removed items.</p>
|
||
|
||
<p>Note 1: The element range is removed even if the iterator is not
|
||
consumed until the end.</p>
|
||
|
||
<p>Note 2: It is unspecified how many elements are removed from the vector,
|
||
if the <code>Drain</code> value is leaked.</p>
|
||
|
||
<h1 id='panics-7' class='section-header'><a href='#panics-7'>Panics</a></h1>
|
||
<p>Panics if the starting point is greater than the end point or if
|
||
the end point is greater than the length of the vector.</p>
|
||
|
||
<h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='kw'>let</span> <span class='ident'>u</span>: <span class='ident'>Vec</span><span class='op'><</span>_<span class='op'>></span> <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>drain</span>(<span class='number'>1</span>..).<span class='ident'>collect</span>();
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>, <span class='kw-2'>&</span>[<span class='number'>1</span>]);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>u</span>, <span class='kw-2'>&</span>[<span class='number'>2</span>, <span class='number'>3</span>]);
|
||
|
||
<span class='comment'>// A full range clears the vector</span>
|
||
<span class='ident'>v</span>.<span class='ident'>drain</span>(..);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>v</span>, <span class='kw-2'>&</span>[]);</pre>
|
||
</div><h4 id='method.clear' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.clear' class='fnname'>clear</a>(&mut self)</code></h4>
|
||
<div class='docblock'><p>Clears the vector, removing all values.</p>
|
||
|
||
<h1 id='examples-14' class='section-header'><a href='#examples-14'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
|
||
<span class='ident'>v</span>.<span class='ident'>clear</span>();
|
||
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>v</span>.<span class='ident'>is_empty</span>());</pre>
|
||
</div><h4 id='method.len' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.len' class='fnname'>len</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a></code></h4>
|
||
<div class='docblock'><p>Returns the number of elements in the vector.</p>
|
||
|
||
<h1 id='examples-15' class='section-header'><a href='#examples-15'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>a</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>];
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>a</span>.<span class='ident'>len</span>(), <span class='number'>3</span>);</pre>
|
||
</div><h4 id='method.is_empty' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||
<div class='docblock'><p>Returns <code>true</code> if the vector contains no elements.</p>
|
||
|
||
<h1 id='examples-16' class='section-header'><a href='#examples-16'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>v</span> <span class='op'>=</span> <span class='ident'>Vec</span>::<span class='ident'>new</span>();
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>v</span>.<span class='ident'>is_empty</span>());
|
||
|
||
<span class='ident'>v</span>.<span class='ident'>push</span>(<span class='number'>1</span>);
|
||
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='op'>!</span><span class='ident'>v</span>.<span class='ident'>is_empty</span>());</pre>
|
||
</div><h4 id='method.split_off' class='method'><span class="since">1.4.0</span><code>fn <a href='#method.split_off' class='fnname'>split_off</a>(&mut self, at: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><T></code></h4>
|
||
<div class='docblock'><p>Splits the collection into two at the given index.</p>
|
||
|
||
<p>Returns a newly allocated <code>Self</code>. <code>self</code> contains elements <code>[0, at)</code>,
|
||
and the returned <code>Self</code> contains elements <code>[at, len)</code>.</p>
|
||
|
||
<p>Note that the capacity of <code>self</code> does not change.</p>
|
||
|
||
<h1 id='panics-8' class='section-header'><a href='#panics-8'>Panics</a></h1>
|
||
<p>Panics if <code>at > len</code>.</p>
|
||
|
||
<h1 id='examples-17' class='section-header'><a href='#examples-17'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>,<span class='number'>2</span>,<span class='number'>3</span>];
|
||
<span class='kw'>let</span> <span class='ident'>vec2</span> <span class='op'>=</span> <span class='ident'>vec</span>.<span class='ident'>split_off</span>(<span class='number'>1</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>]);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec2</span>, [<span class='number'>2</span>, <span class='number'>3</span>]);</pre>
|
||
</div></div><div class='impl-items'><h4 id='method.resize' class='method'><span class="since">1.5.0</span><code>fn <a href='#method.resize' class='fnname'>resize</a>(&mut self, new_len: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>, value: T)</code></h4>
|
||
<div class='docblock'><p>Resizes the <code>Vec</code> in-place so that <code>len()</code> is equal to <code>new_len</code>.</p>
|
||
|
||
<p>If <code>new_len</code> is greater than <code>len()</code>, the <code>Vec</code> is extended by the
|
||
difference, with each additional slot filled with <code>value</code>.
|
||
If <code>new_len</code> is less than <code>len()</code>, the <code>Vec</code> is simply truncated.</p>
|
||
|
||
<h1 id='examples-18' class='section-header'><a href='#examples-18'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"hello"</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>resize</span>(<span class='number'>3</span>, <span class='string'>"world"</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='string'>"hello"</span>, <span class='string'>"world"</span>, <span class='string'>"world"</span>]);
|
||
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>resize</span>(<span class='number'>2</span>, <span class='number'>0</span>);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>]);</pre>
|
||
</div><h4 id='method.extend_from_slice' class='method'><span class="since">1.6.0</span><code>fn <a href='#method.extend_from_slice' class='fnname'>extend_from_slice</a>(&mut self, other: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&[T]</a>)</code></h4>
|
||
<div class='docblock'><p>Appends all elements in a slice to the <code>Vec</code>.</p>
|
||
|
||
<p>Iterates over the slice <code>other</code>, clones each element, and then appends
|
||
it to this <code>Vec</code>. The <code>other</code> vector is traversed in-order.</p>
|
||
|
||
<p>Note that this function is same as <code>extend</code> except that it is
|
||
specialized to work with slices instead. If and when Rust gets
|
||
specialization this function will likely be deprecated (but still
|
||
available).</p>
|
||
|
||
<h1 id='examples-19' class='section-header'><a href='#examples-19'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>];
|
||
<span class='ident'>vec</span>.<span class='ident'>extend_from_slice</span>(<span class='kw-2'>&</span>[<span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>]);
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>]);</pre>
|
||
</div></div><div class='impl-items'><h4 id='method.dedup' class='method'><span class="since">1.0.0</span><code>fn <a href='#method.dedup' class='fnname'>dedup</a>(&mut self)</code></h4>
|
||
<div class='docblock'><p>Removes consecutive repeated elements in the vector.</p>
|
||
|
||
<p>If the vector is sorted, this removes all duplicates.</p>
|
||
|
||
<h1 id='examples-20' class='section-header'><a href='#examples-20'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>vec</span> <span class='op'>=</span> <span class='macro'>vec</span><span class='macro'>!</span>[<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>2</span>];
|
||
|
||
<span class='ident'>vec</span>.<span class='ident'>dedup</span>();
|
||
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>vec</span>, [<span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>2</span>]);</pre>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html' title='core::ops::Deref'>Deref</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='associatedtype.Target' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html#associatedtype.Target' class='type'>Target</a> = <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
<h4 id='method.deref' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&self) -> &<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='associatedtype.Item' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#associatedtype.Item' class='type'>Item</a> = <a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a></code></h4>
|
||
<h4 id='associatedtype.IntoIter' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#associatedtype.IntoIter' class='type'>IntoIter</a> = <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.IntoIter.html' title='collections::vec::IntoIter'>IntoIter</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
<h4 id='method.into_iter' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.IntoIter.html' title='collections::vec::IntoIter'>IntoIter</a><<a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
</div><h3 class='impl'><code>impl<'a> <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a> for &'a <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='associatedtype.Item-1' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#associatedtype.Item' class='type'>Item</a> = &'a <a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a></code></h4>
|
||
<h4 id='associatedtype.IntoIter-1' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#associatedtype.IntoIter' class='type'>IntoIter</a> = <a class='struct' href='https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html' title='core::slice::Iter'>Iter</a><'a, <a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
<h4 id='method.into_iter-1' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> <a class='struct' href='https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html' title='core::slice::Iter'>Iter</a><'a, <a class='struct' href='../regex_syntax/struct.ClassRange.html' title='regex_syntax::ClassRange'>ClassRange</a>></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html' title='core::fmt::Display'>Display</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
|
||
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='method.eq' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||
<h4 id='method.ne' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a>) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='method.fmt-1' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
|
||
</div><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h3><div class='impl-items'><h4 id='method.clone' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class='struct' href='../regex_syntax/struct.CharClass.html' title='regex_syntax::CharClass'>CharClass</a></code></h4>
|
||
<h4 id='method.clone_from' class='method'><span class="since">1.0.0</span><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></h4>
|
||
</div></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>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</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>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../";
|
||
window.currentCrate = "regex_syntax";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../jquery.js"></script>
|
||
<script src="../main.js"></script>
|
||
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |