Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 4e2dbb669434a7691662cb2f0ad38972 > files > 13784

rust-doc-1.28.0-1.mga6.armv7hl.rpm

<!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 `ops` mod in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, ops"><title>std::ops - 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><link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[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='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a><p class='location'>Module ops</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'><a href='../index.html'>std</a></p><script>window.sidebarCurrent = {name: 'ops', ty: 'mod', 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"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><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='in-band'>Module <a href='../index.html'>std</a>::<wbr><a class="mod" href=''>ops</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><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/core/lib.rs.html#180' title='goto source code'>[src]</a></span></h1><div class='docblock'><p>Overloadable operators.</p>
<p>Implementing these traits allows you to overload certain operators.</p>
<p>Some of these traits are imported by the prelude, so they are available in
every Rust program. Only operators backed by traits can be overloaded. For
example, the addition operator (<code>+</code>) can be overloaded through the <a href="trait.Add.html"><code>Add</code></a>
trait, but since the assignment operator (<code>=</code>) has no backing trait, there
is no way of overloading its semantics. Additionally, this module does not
provide any mechanism to create new operators. If traitless overloading or
custom operators are required, you should look toward macros or compiler
plugins to extend Rust's syntax.</p>
<p>Implementations of operator traits should be unsurprising in their
respective contexts, keeping in mind their usual meanings and
<a href="../../reference/expressions.html#expression-precedence">operator precedence</a>. For example, when implementing <a href="trait.Mul.html"><code>Mul</code></a>, the operation
should have some resemblance to multiplication (and share expected
properties like associativity).</p>
<p>Note that the <code>&amp;&amp;</code> and <code>||</code> operators short-circuit, i.e. they only
evaluate their second operand if it contributes to the result. Since this
behavior is not enforceable by traits, <code>&amp;&amp;</code> and <code>||</code> are not supported as
overloadable operators.</p>
<p>Many of the operators take their operands by value. In non-generic
contexts involving built-in types, this is usually not a problem.
However, using these operators in generic code, requires some
attention if values have to be reused as opposed to letting the operators
consume them. One option is to occasionally use <a href="../clone/trait.Clone.html#tymethod.clone"><code>clone</code></a>.
Another option is to rely on the types involved providing additional
operator implementations for references. For example, for a user-defined
type <code>T</code> which is supposed to support addition, it is probably a good
idea to have both <code>T</code> and <code>&amp;T</code> implement the traits <a href="trait.Add.html"><code>Add&lt;T&gt;</code></a> and
<a href="trait.Add.html"><code>Add&lt;&amp;T&gt;</code></a> so that generic code can be written without unnecessary
cloning.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<p>This example creates a <code>Point</code> struct that implements <a href="trait.Add.html"><code>Add</code></a> and <a href="trait.Sub.html"><code>Sub</code></a>,
and then demonstrates adding and subtracting two <code>Point</code>s.</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ops</span>::{<span class="ident">Add</span>, <span class="ident">Sub</span>};

<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">PartialEq</span>)]</span>
<span class="kw">struct</span> <span class="ident">Point</span> {
    <span class="ident">x</span>: <span class="ident">i32</span>,
    <span class="ident">y</span>: <span class="ident">i32</span>,
}

<span class="kw">impl</span> <span class="ident">Add</span> <span class="kw">for</span> <span class="ident">Point</span> {
    <span class="kw">type</span> <span class="ident">Output</span> <span class="op">=</span> <span class="ident">Point</span>;

    <span class="kw">fn</span> <span class="ident">add</span>(<span class="self">self</span>, <span class="ident">other</span>: <span class="ident">Point</span>) <span class="op">-&gt;</span> <span class="ident">Point</span> {
        <span class="ident">Point</span> {<span class="ident">x</span>: <span class="self">self</span>.<span class="ident">x</span> <span class="op">+</span> <span class="ident">other</span>.<span class="ident">x</span>, <span class="ident">y</span>: <span class="self">self</span>.<span class="ident">y</span> <span class="op">+</span> <span class="ident">other</span>.<span class="ident">y</span>}
    }
}

<span class="kw">impl</span> <span class="ident">Sub</span> <span class="kw">for</span> <span class="ident">Point</span> {
    <span class="kw">type</span> <span class="ident">Output</span> <span class="op">=</span> <span class="ident">Point</span>;

    <span class="kw">fn</span> <span class="ident">sub</span>(<span class="self">self</span>, <span class="ident">other</span>: <span class="ident">Point</span>) <span class="op">-&gt;</span> <span class="ident">Point</span> {
        <span class="ident">Point</span> {<span class="ident">x</span>: <span class="self">self</span>.<span class="ident">x</span> <span class="op">-</span> <span class="ident">other</span>.<span class="ident">x</span>, <span class="ident">y</span>: <span class="self">self</span>.<span class="ident">y</span> <span class="op">-</span> <span class="ident">other</span>.<span class="ident">y</span>}
    }
}

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Point</span> {<span class="ident">x</span>: <span class="number">3</span>, <span class="ident">y</span>: <span class="number">3</span>}, <span class="ident">Point</span> {<span class="ident">x</span>: <span class="number">1</span>, <span class="ident">y</span>: <span class="number">0</span>} <span class="op">+</span> <span class="ident">Point</span> {<span class="ident">x</span>: <span class="number">2</span>, <span class="ident">y</span>: <span class="number">3</span>});
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Point</span> {<span class="ident">x</span>: <span class="op">-</span><span class="number">1</span>, <span class="ident">y</span>: <span class="op">-</span><span class="number">3</span>}, <span class="ident">Point</span> {<span class="ident">x</span>: <span class="number">1</span>, <span class="ident">y</span>: <span class="number">0</span>} <span class="op">-</span> <span class="ident">Point</span> {<span class="ident">x</span>: <span class="number">2</span>, <span class="ident">y</span>: <span class="number">3</span>});<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Aops%3A%3A%7BAdd%2C%20Sub%7D%3B%0A%0A%23%5Bderive(Debug%2C%20PartialEq)%5D%0Astruct%20Point%20%7B%0A%20%20%20%20x%3A%20i32%2C%0A%20%20%20%20y%3A%20i32%2C%0A%7D%0A%0Aimpl%20Add%20for%20Point%20%7B%0A%20%20%20%20type%20Output%20%3D%20Point%3B%0A%0A%20%20%20%20fn%20add(self%2C%20other%3A%20Point)%20-%3E%20Point%20%7B%0A%20%20%20%20%20%20%20%20Point%20%7Bx%3A%20self.x%20%2B%20other.x%2C%20y%3A%20self.y%20%2B%20other.y%7D%0A%20%20%20%20%7D%0A%7D%0A%0Aimpl%20Sub%20for%20Point%20%7B%0A%20%20%20%20type%20Output%20%3D%20Point%3B%0A%0A%20%20%20%20fn%20sub(self%2C%20other%3A%20Point)%20-%3E%20Point%20%7B%0A%20%20%20%20%20%20%20%20Point%20%7Bx%3A%20self.x%20-%20other.x%2C%20y%3A%20self.y%20-%20other.y%7D%0A%20%20%20%20%7D%0A%7D%0A%0Aassert_eq!(Point%20%7Bx%3A%203%2C%20y%3A%203%7D%2C%20Point%20%7Bx%3A%201%2C%20y%3A%200%7D%20%2B%20Point%20%7Bx%3A%202%2C%20y%3A%203%7D)%3B%0Aassert_eq!(Point%20%7Bx%3A%20-1%2C%20y%3A%20-3%7D%2C%20Point%20%7Bx%3A%201%2C%20y%3A%200%7D%20-%20Point%20%7Bx%3A%202%2C%20y%3A%203%7D)%3B%0A%7D">Run</a></pre>
<p>See the documentation for each trait for an example implementation.</p>
<p>The <a href="trait.Fn.html"><code>Fn</code></a>, <a href="trait.FnMut.html"><code>FnMut</code></a>, and <a href="trait.FnOnce.html"><code>FnOnce</code></a> traits are implemented by types that can be
invoked like functions. Note that <a href="trait.Fn.html"><code>Fn</code></a> takes <code>&amp;self</code>, <a href="trait.FnMut.html"><code>FnMut</code></a> takes <code>&amp;mut self</code> and <a href="trait.FnOnce.html"><code>FnOnce</code></a> takes <code>self</code>. These correspond to the three kinds of
methods that can be invoked on an instance: call-by-reference,
call-by-mutable-reference, and call-by-value. The most common use of these
traits is to act as bounds to higher-level functions that take functions or
closures as arguments.</p>
<p>Taking a <a href="trait.Fn.html"><code>Fn</code></a> as a parameter:</p>

<pre class="rust rust-example-rendered">
<span class="kw">fn</span> <span class="ident">call_with_one</span><span class="op">&lt;</span><span class="ident">F</span><span class="op">&gt;</span>(<span class="ident">func</span>: <span class="ident">F</span>) <span class="op">-&gt;</span> <span class="ident">usize</span>
    <span class="kw">where</span> <span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">usize</span>) <span class="op">-&gt;</span> <span class="ident">usize</span>
{
    <span class="ident">func</span>(<span class="number">1</span>)
}

<span class="kw">let</span> <span class="ident">double</span> <span class="op">=</span> <span class="op">|</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="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">call_with_one</span>(<span class="ident">double</span>), <span class="number">2</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20call_with_one%3CF%3E(func%3A%20F)%20-%3E%20usize%0A%20%20%20%20where%20F%3A%20Fn(usize)%20-%3E%20usize%0A%7B%0A%20%20%20%20func(1)%0A%7D%0A%0Alet%20double%20%3D%20%7Cx%7C%20x%20*%202%3B%0Aassert_eq!(call_with_one(double)%2C%202)%3B%0A%7D">Run</a></pre>
<p>Taking a <a href="trait.FnMut.html"><code>FnMut</code></a> as a parameter:</p>

<pre class="rust rust-example-rendered">
<span class="kw">fn</span> <span class="ident">do_twice</span><span class="op">&lt;</span><span class="ident">F</span><span class="op">&gt;</span>(<span class="kw-2">mut</span> <span class="ident">func</span>: <span class="ident">F</span>)
    <span class="kw">where</span> <span class="ident">F</span>: <span class="ident">FnMut</span>()
{
    <span class="ident">func</span>();
    <span class="ident">func</span>();
}

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">x</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">1</span>;
{
    <span class="kw">let</span> <span class="ident">add_two_to_x</span> <span class="op">=</span> <span class="op">||</span> <span class="ident">x</span> <span class="op">+=</span> <span class="number">2</span>;
    <span class="ident">do_twice</span>(<span class="ident">add_two_to_x</span>);
}

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="number">5</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20do_twice%3CF%3E(mut%20func%3A%20F)%0A%20%20%20%20where%20F%3A%20FnMut()%0A%7B%0A%20%20%20%20func()%3B%0A%20%20%20%20func()%3B%0A%7D%0A%0Alet%20mut%20x%3A%20usize%20%3D%201%3B%0A%7B%0A%20%20%20%20let%20add_two_to_x%20%3D%20%7C%7C%20x%20%2B%3D%202%3B%0A%20%20%20%20do_twice(add_two_to_x)%3B%0A%7D%0A%0Aassert_eq!(x%2C%205)%3B%0A%7D">Run</a></pre>
<p>Taking a <a href="trait.FnOnce.html"><code>FnOnce</code></a> as a parameter:</p>

<pre class="rust rust-example-rendered">
<span class="kw">fn</span> <span class="ident">consume_with_relish</span><span class="op">&lt;</span><span class="ident">F</span><span class="op">&gt;</span>(<span class="ident">func</span>: <span class="ident">F</span>)
    <span class="kw">where</span> <span class="ident">F</span>: <span class="ident">FnOnce</span>() <span class="op">-&gt;</span> <span class="ident">String</span>
{
    <span class="comment">// `func` consumes its captured variables, so it cannot be run more</span>
    <span class="comment">// than once</span>
    <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Consumed: {}&quot;</span>, <span class="ident">func</span>());

    <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Delicious!&quot;</span>);

    <span class="comment">// Attempting to invoke `func()` again will throw a `use of moved</span>
    <span class="comment">// value` error for `func`</span>
}

<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;x&quot;</span>);
<span class="kw">let</span> <span class="ident">consume_and_return_x</span> <span class="op">=</span> <span class="kw">move</span> <span class="op">||</span> <span class="ident">x</span>;
<span class="ident">consume_with_relish</span>(<span class="ident">consume_and_return_x</span>);

<span class="comment">// `consume_and_return_x` can no longer be invoked at this point</span><a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20consume_with_relish%3CF%3E(func%3A%20F)%0A%20%20%20%20where%20F%3A%20FnOnce()%20-%3E%20String%0A%7B%0A%20%20%20%20%2F%2F%20%60func%60%20consumes%20its%20captured%20variables%2C%20so%20it%20cannot%20be%20run%20more%0A%20%20%20%20%2F%2F%20than%20once%0A%20%20%20%20println!(%22Consumed%3A%20%7B%7D%22%2C%20func())%3B%0A%0A%20%20%20%20println!(%22Delicious!%22)%3B%0A%0A%20%20%20%20%2F%2F%20Attempting%20to%20invoke%20%60func()%60%20again%20will%20throw%20a%20%60use%20of%20moved%0A%20%20%20%20%2F%2F%20value%60%20error%20for%20%60func%60%0A%7D%0A%0Alet%20x%20%3D%20String%3A%3Afrom(%22x%22)%3B%0Alet%20consume_and_return_x%20%3D%20move%20%7C%7C%20x%3B%0Aconsume_with_relish(consume_and_return_x)%3B%0A%0A%2F%2F%20%60consume_and_return_x%60%20can%20no%20longer%20be%20invoked%20at%20this%20point%0A%7D">Run</a></pre>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.Range.html"
                                  title='struct std::ops::Range'>Range</a></td>
                           <td class='docblock-short'>
                                <p>A (half-open) range bounded inclusively below and exclusively above
(<code>start..end</code>).</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RangeFrom.html"
                                  title='struct std::ops::RangeFrom'>RangeFrom</a></td>
                           <td class='docblock-short'>
                                <p>A range only bounded inclusively below (<code>start..</code>).</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RangeFull.html"
                                  title='struct std::ops::RangeFull'>RangeFull</a></td>
                           <td class='docblock-short'>
                                <p>An unbounded range (<code>..</code>).</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RangeInclusive.html"
                                  title='struct std::ops::RangeInclusive'>RangeInclusive</a></td>
                           <td class='docblock-short'>
                                <p>An range bounded inclusively below and above (<code>start..=end</code>).</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RangeTo.html"
                                  title='struct std::ops::RangeTo'>RangeTo</a></td>
                           <td class='docblock-short'>
                                <p>A range only bounded exclusively above (<code>..end</code>).</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="struct" href="struct.RangeToInclusive.html"
                                  title='struct std::ops::RangeToInclusive'>RangeToInclusive</a></td>
                           <td class='docblock-short'>
                                <p>A range only bounded inclusively above (<code>..=end</code>).</p>

                           </td>
                       </tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="enum" href="enum.Bound.html"
                                  title='enum std::ops::Bound'>Bound</a></td>
                           <td class='docblock-short'>
                                <p>An endpoint of a range of keys.</p>

                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="enum" href="enum.GeneratorState.html"
                                  title='enum std::ops::GeneratorState'>GeneratorState</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>The result of a generator resumption.</p>

                           </td>
                       </tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Add.html"
                                  title='trait std::ops::Add'>Add</a></td>
                           <td class='docblock-short'>
                                <p>The addition operator <code>+</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.AddAssign.html"
                                  title='trait std::ops::AddAssign'>AddAssign</a></td>
                           <td class='docblock-short'>
                                <p>The addition assignment operator <code>+=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitAnd.html"
                                  title='trait std::ops::BitAnd'>BitAnd</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise AND operator <code>&amp;</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitAndAssign.html"
                                  title='trait std::ops::BitAndAssign'>BitAndAssign</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise AND assignment operator <code>&amp;=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitOr.html"
                                  title='trait std::ops::BitOr'>BitOr</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise OR operator <code>|</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitOrAssign.html"
                                  title='trait std::ops::BitOrAssign'>BitOrAssign</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise OR assignment operator <code>|=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitXor.html"
                                  title='trait std::ops::BitXor'>BitXor</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise XOR operator <code>^</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.BitXorAssign.html"
                                  title='trait std::ops::BitXorAssign'>BitXorAssign</a></td>
                           <td class='docblock-short'>
                                <p>The bitwise XOR assignment operator <code>^=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Deref.html"
                                  title='trait std::ops::Deref'>Deref</a></td>
                           <td class='docblock-short'>
                                <p>Used for immutable dereferencing operations, like <code>*v</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.DerefMut.html"
                                  title='trait std::ops::DerefMut'>DerefMut</a></td>
                           <td class='docblock-short'>
                                <p>Used for mutable dereferencing operations, like in <code>*v = 1;</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Div.html"
                                  title='trait std::ops::Div'>Div</a></td>
                           <td class='docblock-short'>
                                <p>The division operator <code>/</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.DivAssign.html"
                                  title='trait std::ops::DivAssign'>DivAssign</a></td>
                           <td class='docblock-short'>
                                <p>The division assignment operator <code>/=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Drop.html"
                                  title='trait std::ops::Drop'>Drop</a></td>
                           <td class='docblock-short'>
                                <p>Used to run some code when a value goes out of scope.
This is sometimes called a 'destructor'.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Fn.html"
                                  title='trait std::ops::Fn'>Fn</a></td>
                           <td class='docblock-short'>
                                <p>The version of the call operator that takes an immutable receiver.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.FnMut.html"
                                  title='trait std::ops::FnMut'>FnMut</a></td>
                           <td class='docblock-short'>
                                <p>The version of the call operator that takes a mutable receiver.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.FnOnce.html"
                                  title='trait std::ops::FnOnce'>FnOnce</a></td>
                           <td class='docblock-short'>
                                <p>The version of the call operator that takes a by-value receiver.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Index.html"
                                  title='trait std::ops::Index'>Index</a></td>
                           <td class='docblock-short'>
                                <p>Used for indexing operations (<code>container[index]</code>) in immutable contexts.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.IndexMut.html"
                                  title='trait std::ops::IndexMut'>IndexMut</a></td>
                           <td class='docblock-short'>
                                <p>Used for indexing operations (<code>container[index]</code>) in mutable contexts.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Mul.html"
                                  title='trait std::ops::Mul'>Mul</a></td>
                           <td class='docblock-short'>
                                <p>The multiplication operator <code>*</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.MulAssign.html"
                                  title='trait std::ops::MulAssign'>MulAssign</a></td>
                           <td class='docblock-short'>
                                <p>The multiplication assignment operator <code>*=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Neg.html"
                                  title='trait std::ops::Neg'>Neg</a></td>
                           <td class='docblock-short'>
                                <p>The unary negation operator <code>-</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Not.html"
                                  title='trait std::ops::Not'>Not</a></td>
                           <td class='docblock-short'>
                                <p>The unary logical negation operator <code>!</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.RangeBounds.html"
                                  title='trait std::ops::RangeBounds'>RangeBounds</a></td>
                           <td class='docblock-short'>
                                <p><code>RangeBounds</code> is implemented by Rust's built-in range types, produced
by range syntax like <code>..</code>, <code>a..</code>, <code>..b</code> or <code>c..d</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Rem.html"
                                  title='trait std::ops::Rem'>Rem</a></td>
                           <td class='docblock-short'>
                                <p>The remainder operator <code>%</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.RemAssign.html"
                                  title='trait std::ops::RemAssign'>RemAssign</a></td>
                           <td class='docblock-short'>
                                <p>The remainder assignment operator <code>%=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Shl.html"
                                  title='trait std::ops::Shl'>Shl</a></td>
                           <td class='docblock-short'>
                                <p>The left shift operator <code>&lt;&lt;</code>. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust's type
checker has special handling for <code>_ &lt;&lt; _</code>, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though <code>a &lt;&lt; b</code> and <code>a.shl(b)</code> are one and the same from an evaluation
standpoint, they are different when it comes to type inference.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.ShlAssign.html"
                                  title='trait std::ops::ShlAssign'>ShlAssign</a></td>
                           <td class='docblock-short'>
                                <p>The left shift assignment operator <code>&lt;&lt;=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Shr.html"
                                  title='trait std::ops::Shr'>Shr</a></td>
                           <td class='docblock-short'>
                                <p>The right shift operator <code>&gt;&gt;</code>. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust's type
checker has special handling for <code>_ &gt;&gt; _</code>, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though <code>a &gt;&gt; b</code> and <code>a.shr(b)</code> are one and the same from an evaluation
standpoint, they are different when it comes to type inference.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.ShrAssign.html"
                                  title='trait std::ops::ShrAssign'>ShrAssign</a></td>
                           <td class='docblock-short'>
                                <p>The right shift assignment operator <code>&gt;&gt;=</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.Sub.html"
                                  title='trait std::ops::Sub'>Sub</a></td>
                           <td class='docblock-short'>
                                <p>The subtraction operator <code>-</code>.</p>

                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="trait" href="trait.SubAssign.html"
                                  title='trait std::ops::SubAssign'>SubAssign</a></td>
                           <td class='docblock-short'>
                                <p>The subtraction assignment operator <code>-=</code>.</p>

                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.CoerceUnsized.html"
                                  title='trait std::ops::CoerceUnsized'>CoerceUnsized</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Trait that indicates that this is a pointer or a wrapper for one,
where unsizing can be performed on the pointee.</p>

                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.Generator.html"
                                  title='trait std::ops::Generator'>Generator</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>The trait implemented by builtin generator types.</p>

                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.Try.html"
                                  title='trait std::ops::Try'>Try</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>A trait for customizing the behavior of the <code>?</code> operator.</p>

                           </td>
                       </tr></table></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 = "std";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>