Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 878cdd00a13d17a73c6619a777ef5d74 > files > 4442

rust-doc-1.19.0-1.mga6.x86_64.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">
    <link rel="stylesheet" type="text/css" href="../../main.css">
    

    <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">
        <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="block items"><ul><li><a href="#structs">Structs</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>
    </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">
<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/ops.rs.html#11-3021' 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&#39;s syntax.</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>
<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="kw">fn</span> <span class="ident">main</span>() {
    <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</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">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</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=use%20std%3A%3Aops%3A%3A%7BAdd%2C%20Sub%7D%3B%0A%0A%23%5Bderive(Debug)%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%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22%7B%3A%3F%7D%22%2C%20Point%20%7Bx%3A%201%2C%20y%3A%200%7D%20%2B%20Point%20%7Bx%3A%202%2C%20y%3A%203%7D)%3B%0A%20%20%20%20println!(%22%7B%3A%3F%7D%22%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%0A">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=fn%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=fn%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=fn%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 which is bounded at both ends: { x | start &lt;= x &lt; end }.
Use <code>start..end</code> (two dots) for its shorthand.</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 which is only bounded below: { x | start &lt;= x }.
Use <code>start..</code> for its shorthand.</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. Use <code>..</code> (two dots) for its shorthand.</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 which is only bounded above: { x | x &lt; end }.
Use <code>..end</code> (two dots) for its shorthand.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="struct" href="struct.RangeInclusive.html"
                                  title='struct std::ops::RangeInclusive'>RangeInclusive</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>An inclusive range which is bounded at both ends: { x | start &lt;= x &lt;= end }.
Use <code>start...end</code> (three dots) for its shorthand.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="struct" href="struct.RangeToInclusive.html"
                                  title='struct std::ops::RangeToInclusive'>RangeToInclusive</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>An inclusive range which is only bounded above: { x | x &lt;= end }.
Use <code>...end</code> (three dots) for its shorthand.</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>The <code>Deref</code> trait is used to specify the functionality of 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>The <code>DerefMut</code> trait is used to specify the functionality of dereferencing
mutably like <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>The <code>Drop</code> trait is used to run some code when a value goes out of scope.
This is sometimes called a &#39;destructor&#39;.</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>A 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>A 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>A 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>The <code>Index</code> trait is used to specify the functionality of indexing operations
like <code>container[index]</code> when used in an immutable context.</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>The <code>IndexMut</code> trait is used to specify the functionality of indexing
operations like <code>container[index]</code> when used in a mutable context.</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.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>.</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>.</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.BoxPlace.html"
                                  title='trait std::ops::BoxPlace'>BoxPlace</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Specialization of <code>Place</code> trait supporting <code>box EXPR</code>.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.Boxed.html"
                                  title='trait std::ops::Boxed'>Boxed</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Core trait for the <code>box EXPR</code> form.</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.InPlace.html"
                                  title='trait std::ops::InPlace'>InPlace</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Specialization of <code>Place</code> trait supporting <code>PLACE &lt;- EXPR</code>.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.Place.html"
                                  title='trait std::ops::Place'>Place</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Both <code>PLACE &lt;- EXPR</code> and <code>box EXPR</code> desugar into expressions
that allocate an intermediate &quot;place&quot; that holds uninitialized
state.  The desugaring evaluates EXPR, and writes the result at
the address returned by the <code>pointer</code> method of this trait.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="trait" href="trait.Placer.html"
                                  title='trait std::ops::Placer'>Placer</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Interface to implementations of  <code>PLACE &lt;- EXPR</code>.</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 behaviour 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>?</dt>
                    <dd>Show this help dialog</dd>
                    <dt>S</dt>
                    <dd>Focus the search field</dd>
                    <dt>&larrb;</dt>
                    <dd>Move up in search results</dd>
                    <dt>&rarrb;</dt>
                    <dd>Move down in search results</dd>
                    <dt>&#9166;</dt>
                    <dd>Go to active search result</dd>
                    <dt>+</dt>
                    <dd>Collapse/expand 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>
            </div>
        </div>
    </aside>

    

    <script>
        window.rootPath = "../../";
        window.currentCrate = "std";
    </script>
    <script src="../../main.js"></script>
    <script defer src="../../search-index.js"></script>
</body>
</html>