Sophie

Sophie

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

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 `never` primitive in crate `std`."><meta name="keywords" content="rust, rustlang, rust-lang, never"><title>never - 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 primitive"><!--[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'>Primitive Type never</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Display">Display</a><a href="#impl-PartialEq%3C!%3E">PartialEq&lt;!&gt;</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialOrd%3C!%3E">PartialOrd&lt;!&gt;</a><a href="#impl-Debug">Debug</a><a href="#impl-Hash">Hash</a><a href="#impl-Eq">Eq</a><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Error">Error</a><a href="#impl-Termination">Termination</a></div></div><p class='location'><a href='index.html'>std</a></p><script>window.sidebarCurrent = {name: 'never', ty: 'primitive', 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'>Primitive Type <a class="primitive" href=''>never</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'>&#x2212;</span>]</a></span></span></h1><div class='docblock'><p>The <code>!</code> type, also called &quot;never&quot;.</p>
<p><code>!</code> represents the type of computations which never resolve to any value at all. For example,
the <a href="process/fn.exit.html"><code>exit</code></a> function <code>fn exit(code: i32) -&gt; !</code> exits the process without ever returning, and
so returns <code>!</code>.</p>
<p><code>break</code>, <code>continue</code> and <code>return</code> expressions also have type <code>!</code>. For example we are allowed to
write:</p>

<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">never_type</span>)]</span>
<span class="kw">let</span> <span class="ident">x</span>: <span class="op">!</span> <span class="op">=</span> {
    <span class="kw">return</span> <span class="number">123</span>
};<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(never_type)%5D%0Afn%20main()%20%7B%0Afn%20foo()%20-%3E%20u32%20%7B%0Alet%20x%3A%20!%20%3D%20%7B%0A%20%20%20%20return%20123%0A%7D%3B%0A%7D%0A%7D&amp;version=nightly">Run</a></pre>
<p>Although the <code>let</code> is pointless here, it illustrates the meaning of <code>!</code>. Since <code>x</code> is never
assigned a value (because <code>return</code> returns from the entire function), <code>x</code> can be given type
<code>!</code>. We could also replace <code>return 123</code> with a <code>panic!</code> or a never-ending <code>loop</code> and this code
would still be valid.</p>
<p>A more realistic usage of <code>!</code> is in this code:</p>

<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">num</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">get_a_number</span>() {
    <span class="prelude-val">Some</span>(<span class="ident">num</span>) <span class="op">=&gt;</span> <span class="ident">num</span>,
    <span class="prelude-val">None</span> <span class="op">=&gt;</span> <span class="kw">break</span>,
};<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20get_a_number()%20-%3E%20Option%3Cu32%3E%20%7B%20None%20%7D%0Aloop%20%7B%0Alet%20num%3A%20u32%20%3D%20match%20get_a_number()%20%7B%0A%20%20%20%20Some(num)%20%3D%3E%20num%2C%0A%20%20%20%20None%20%3D%3E%20break%2C%0A%7D%3B%0A%7D%0A%7D">Run</a></pre>
<p>Both match arms must produce values of type <a href="primitive.str.html"><code>u32</code></a>, but since <code>break</code> never produces a value
at all we know it can never produce a value which isn't a <a href="primitive.str.html"><code>u32</code></a>. This illustrates another
behaviour of the <code>!</code> type - expressions with type <code>!</code> will coerce into any other type.</p>
<h1 id="-and-generics" class="section-header"><a href="#-and-generics"><code>!</code> and generics</a></h1><h2 id="infallible-errors" class="section-header"><a href="#infallible-errors">Infallible errors</a></h2>
<p>The main place you'll see <code>!</code> used explicitly is in generic code. Consider the <a href="str/trait.FromStr.html"><code>FromStr</code></a>
trait:</p>

<pre class="rust rust-example-rendered">
<span class="kw">trait</span> <span class="ident">FromStr</span>: <span class="ident">Sized</span> {
    <span class="kw">type</span> <span class="prelude-val">Err</span>;
    <span class="kw">fn</span> <span class="ident">from_str</span>(<span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span>, <span class="self">Self</span>::<span class="prelude-val">Err</span><span class="op">&gt;</span>;
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Atrait%20FromStr%3A%20Sized%20%7B%0A%20%20%20%20type%20Err%3B%0A%20%20%20%20fn%20from_str(s%3A%20%26str)%20-%3E%20Result%3CSelf%2C%20Self%3A%3AErr%3E%3B%0A%7D%0A%7D">Run</a></pre>
<p>When implementing this trait for <a href="string/struct.String.html"><code>String</code></a> we need to pick a type for <a href="result/enum.Result.html#variant.Err"><code>Err</code></a>. And since
converting a string into a string will never result in an error, the appropriate type is <code>!</code>.
(Currently the type actually used is an enum with no variants, though this is only because <code>!</code>
was added to Rust at a later date and it may change in the future). With an <a href="result/enum.Result.html#variant.Err"><code>Err</code></a> type of
<code>!</code>, if we have to call <a href="str/trait.FromStr.html#tymethod.from_str"><code>String::from_str</code></a> for some reason the result will be a
<a href="result/enum.Result.html"><code>Result&lt;String, !&gt;</code></a> which we can unpack like this:</p>

<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
<span class="attribute">#[<span class="ident">feature</span>(<span class="ident">exhaustive_patterns</span>)]</span>
<span class="comment">// NOTE: This does not work today!</span>
<span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">s</span>) <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from_str</span>(<span class="string">&quot;hello&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%23%5Bfeature(exhaustive_patterns)%5D%0A%2F%2F%20NOTE%3A%20This%20does%20not%20work%20today!%0Alet%20Ok(s)%20%3D%20String%3A%3Afrom_str(%22hello%22)%3B%0A%7D">Run</a></pre>
<p>Since the <a href="result/enum.Result.html#variant.Err"><code>Err</code></a> variant contains a <code>!</code>, it can never occur. If the <code>exhaustive_patterns</code>
feature is present this means we can exhaustively match on <a href="result/enum.Result.html"><code>Result&lt;T, !&gt;</code></a> by just taking the
<a href="result/enum.Result.html#variant.Ok"><code>Ok</code></a> variant. This illustrates another behaviour of <code>!</code> - it can be used to &quot;delete&quot; certain
enum variants from generic types like <code>Result</code>.</p>
<h2 id="infinite-loops" class="section-header"><a href="#infinite-loops">Infinite loops</a></h2>
<p>While <a href="result/enum.Result.html"><code>Result&lt;T, !&gt;</code></a> is very useful for removing errors, <code>!</code> can also be used to remove
successes as well. If we think of <a href="result/enum.Result.html"><code>Result&lt;T, !&gt;</code></a> as &quot;if this function returns, it has not
errored,&quot; we get a very intuitive idea of <a href="result/enum.Result.html"><code>Result&lt;!, E&gt;</code></a> as well: if the function returns, it
<em>has</em> errored.</p>
<p>For example, consider the case of a simple web server, which can be simplified to:</p>

<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
<span class="kw">loop</span> {
    <span class="kw">let</span> (<span class="ident">client</span>, <span class="ident">request</span>) <span class="op">=</span> <span class="ident">get_request</span>().<span class="ident">expect</span>(<span class="string">&quot;disconnected&quot;</span>);
    <span class="kw">let</span> <span class="ident">response</span> <span class="op">=</span> <span class="ident">request</span>.<span class="ident">process</span>();
    <span class="ident">response</span>.<span class="ident">send</span>(<span class="ident">client</span>);
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aloop%20%7B%0A%20%20%20%20let%20(client%2C%20request)%20%3D%20get_request().expect(%22disconnected%22)%3B%0A%20%20%20%20let%20response%20%3D%20request.process()%3B%0A%20%20%20%20response.send(client)%3B%0A%7D%0A%7D">Run</a></pre>
<p>Currently, this isn't ideal, because we simply panic whenever we fail to get a new connection.
Instead, we'd like to keep track of this error, like this:</p>

<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
<span class="kw">loop</span> {
    <span class="kw">match</span> <span class="ident">get_request</span>() {
        <span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=&gt;</span> <span class="kw">break</span> <span class="ident">err</span>,
        <span class="prelude-val">Ok</span>((<span class="ident">client</span>, <span class="ident">request</span>)) <span class="op">=&gt;</span> {
            <span class="kw">let</span> <span class="ident">response</span> <span class="op">=</span> <span class="ident">request</span>.<span class="ident">process</span>();
            <span class="ident">response</span>.<span class="ident">send</span>(<span class="ident">client</span>);
        },
    }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aloop%20%7B%0A%20%20%20%20match%20get_request()%20%7B%0A%20%20%20%20%20%20%20%20Err(err)%20%3D%3E%20break%20err%2C%0A%20%20%20%20%20%20%20%20Ok((client%2C%20request))%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20let%20response%20%3D%20request.process()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20response.send(client)%3B%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%7D%0A%7D%0A%7D">Run</a></pre>
<p>Now, when the server disconnects, we exit the loop with an error instead of panicking. While it
might be intuitive to simply return the error, we might want to wrap it in a <a href="result/enum.Result.html"><code>Result&lt;!, E&gt;</code></a>
instead:</p>

<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
<span class="kw">fn</span> <span class="ident">server_loop</span>() <span class="op">-&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="op">!</span>, <span class="ident">ConnectionError</span><span class="op">&gt;</span> {
    <span class="kw">loop</span> {
        <span class="kw">let</span> (<span class="ident">client</span>, <span class="ident">request</span>) <span class="op">=</span> <span class="ident">get_request</span>()<span class="question-mark">?</span>;
        <span class="kw">let</span> <span class="ident">response</span> <span class="op">=</span> <span class="ident">request</span>.<span class="ident">process</span>();
        <span class="ident">response</span>.<span class="ident">send</span>(<span class="ident">client</span>);
    }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20server_loop()%20-%3E%20Result%3C!%2C%20ConnectionError%3E%20%7B%0A%20%20%20%20loop%20%7B%0A%20%20%20%20%20%20%20%20let%20(client%2C%20request)%20%3D%20get_request()%3F%3B%0A%20%20%20%20%20%20%20%20let%20response%20%3D%20request.process()%3B%0A%20%20%20%20%20%20%20%20response.send(client)%3B%0A%20%20%20%20%7D%0A%7D%0A%7D">Run</a></pre>
<p>Now, we can use <code>?</code> instead of <code>match</code>, and the return type makes a lot more sense: if the loop
ever stops, it means that an error occurred. We don't even have to wrap the loop in an <code>Ok</code>
because <code>!</code> coerces to <code>Result&lt;!, ConnectionError&gt;</code> automatically.</p>
<h1 id="-and-traits" class="section-header"><a href="#-and-traits"><code>!</code> and traits</a></h1>
<p>When writing your own traits, <code>!</code> should have an <code>impl</code> whenever there is an obvious <code>impl</code>
which doesn't <code>panic!</code>. As is turns out, most traits can have an <code>impl</code> for <code>!</code>. Take <a href="fmt/trait.Debug.html"><code>Debug</code></a>
for example:</p>

<pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">never_type</span>)]</span>
<span class="kw">impl</span> <span class="ident">Debug</span> <span class="kw">for</span> <span class="op">!</span> {
    <span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">fmt</span>::<span class="ident">Formatter</span>) <span class="op">-&gt;</span> <span class="ident">fmt</span>::<span class="prelude-ty">Result</span> {
        <span class="kw-2">*</span><span class="self">self</span>
    }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(never_type)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afmt%3B%0Atrait%20Debug%20%7B%0Afn%20fmt(%26self%2C%20formatter%3A%20%26mut%20fmt%3A%3AFormatter)%20-%3E%20fmt%3A%3AResult%3B%0A%7D%0Aimpl%20Debug%20for%20!%20%7B%0A%20%20%20%20fn%20fmt(%26self%2C%20formatter%3A%20%26mut%20fmt%3A%3AFormatter)%20-%3E%20fmt%3A%3AResult%20%7B%0A%20%20%20%20%20%20%20%20*self%0A%20%20%20%20%7D%0A%7D%0A%7D&amp;version=nightly">Run</a></pre>
<p>Once again we're using <code>!</code>'s ability to coerce into any other type, in this case
<a href="fmt/type.Result.html"><code>fmt::Result</code></a>. Since this method takes a <code>&amp;!</code> as an argument we know that it can never be
called (because there is no value of type <code>!</code> for it to be called with). Writing <code>*self</code>
essentially tells the compiler &quot;We know that this code can never be run, so just treat the
entire function body has having type <a href="fmt/type.Result.html"><code>fmt::Result</code></a>&quot;. This pattern can be used a lot when
implementing traits for <code>!</code>. Generally, any trait which only has methods which take a <code>self</code>
parameter should have such as impl.</p>
<p>On the other hand, one trait which would not be appropriate to implement is <a href="default/trait.Default.html"><code>Default</code></a>:</p>

<pre class="rust rust-example-rendered">
<span class="kw">trait</span> <span class="ident">Default</span> {
    <span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-&gt;</span> <span class="self">Self</span>;
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Atrait%20Default%20%7B%0A%20%20%20%20fn%20default()%20-%3E%20Self%3B%0A%7D%0A%7D">Run</a></pre>
<p>Since <code>!</code> has no values, it has no default value either. It's true that we could write an
<code>impl</code> for this which simply panics, but the same is true for any type (we could <code>impl Default</code> for (eg.) <a href="fs/struct.File.html"><code>File</code></a> by just making <a href="default/trait.Default.html#tymethod.default"><code>default()</code></a> panic.)</p>
</div>
                <h2 id='implementations' class='small-section-header'>
                  Trait Implementations<a href='#implementations' class='anchor'></a>
                </h2>
                <div id='implementations-list'><h3 id='impl-Display' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/fmt/trait.Display.html" title="trait std::fmt::Display">Display</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Display' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/fmt/mod.rs.html#1869-1873' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, &amp;mut <a class="struct" href="../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="primitive" href="primitive.unit.html">()</a>, <a class="struct" href="../std/fmt/struct.Error.html" title="struct std::fmt::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/fmt/mod.rs.html#1870-1872' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="../std/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-PartialEq%3C!%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="primitive" href="primitive.never.html">!</a>&gt; for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-PartialEq%3C!%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#897-901' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, &amp;<a class="primitive" href="primitive.never.html">!</a>) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#898-900' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: <a class="primitive" href="primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/cmp.rs.html#123' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id='impl-Ord' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Ord' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#914-918' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&amp;self, &amp;<a class="primitive" href="primitive.never.html">!</a>) -&gt; <a class="enum" href="../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#915-917' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="../std/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
</div><h4 id='method.max' class="method"><span id='max.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/cmp/trait.Ord.html#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='../src/core/cmp.rs.html#469-472' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Compares and returns the maximum of two values. <a href="../std/cmp/trait.Ord.html#method.max">Read more</a></p>
</div><h4 id='method.min' class="method"><span id='min.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/cmp/trait.Ord.html#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='../src/core/cmp.rs.html#485-488' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Compares and returns the minimum of two values. <a href="../std/cmp/trait.Ord.html#method.min">Read more</a></p>
</div></div><h3 id='impl-PartialOrd%3C!%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="primitive" href="primitive.never.html">!</a>&gt; for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-PartialOrd%3C!%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#907-911' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, &amp;<a class="primitive" href="primitive.never.html">!</a>) -&gt; <a class="enum" href="../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#908-910' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: <a class="primitive" href="primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/cmp.rs.html#657-662' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: <a class="primitive" href="primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/cmp.rs.html#679-684' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: <a class="primitive" href="primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/cmp.rs.html#700-705' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><table class='table-display'><tbody><tr><td><code><div class="docblock attributes">#[must_use]
</div>fn <a href='../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: <a class="primitive" href="primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="primitive.bool.html">bool</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/cmp.rs.html#722-727' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/fmt/mod.rs.html#1862-1866' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt-1' class="method"><span id='fmt.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, &amp;mut <a class="struct" href="../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="primitive" href="primitive.unit.html">()</a>, <a class="struct" href="../std/fmt/struct.Error.html" title="struct std::fmt::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/fmt/mod.rs.html#1863-1865' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="../std/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-Hash' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Hash' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.29.0'>1.29.0</div><a class='srclink' href='../src/core/hash/mod.rs.html#607-611' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a>&lt;H&gt;(&amp;self, <a class="primitive" href="primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/hash/mod.rs.html#608-610' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="../std/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div><h4 id='method.hash_slice' class="method"><span id='hash_slice.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a>&lt;H&gt;(data: <a class="primitive" href="primitive.slice.html">&amp;[Self]</a>, state: <a class="primitive" href="primitive.reference.html">&amp;mut </a>H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>,&nbsp;</span></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='../src/core/hash/mod.rs.html#203-209' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="../std/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></div><h3 id='impl-Eq' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Eq' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/cmp.rs.html#904' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Clone' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Clone' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/clone.rs.html#182-187' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="primitive" href="primitive.never.html">!</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/clone.rs.html#184-186' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a copy of the value. <a href="../std/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="primitive.reference.html">&amp;</a>Self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/core/clone.rs.html#130-132' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="../std/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Copy' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Copy' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/core/marker.rs.html#645' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Error' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Error' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/std/error.rs.html#224-226' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.description' class="method"><span id='description.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/error/trait.Error.html#method.description' class='fnname'>description</a>(&amp;self) -&gt; &amp;<a class="primitive" href="primitive.str.html">str</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/std/error.rs.html#225' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This method is soft-deprecated. <a href="../std/error/trait.Error.html#method.description">Read more</a></p>
</div><h4 id='method.cause' class="method"><span id='cause.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/error/trait.Error.html#method.cause' class='fnname'>cause</a>(&amp;self) -&gt; <a class="enum" href="../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="trait" href="../std/error/trait.Error.html" title="trait std::error::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../src/std/error.rs.html#140' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>The lower-level cause of this error, if any. <a href="../std/error/trait.Error.html#method.cause">Read more</a></p>
</div></div><h3 id='impl-Termination' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../std/process/trait.Termination.html" title="trait std::process::Termination">Termination</a> for <a class="primitive" href="primitive.never.html">!</a></code><a href='#impl-Termination' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/std/process.rs.html#1479-1481' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.report' class="method"><span id='report.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../std/process/trait.Termination.html#tymethod.report' class='fnname'>report</a>(self) -&gt; <a class="primitive" href="primitive.i32.html">i32</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/std/process.rs.html#1480' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>termination_trait_lib </code><a href="https://github.com/rust-lang/rust/issues/43301">#43301</a>)</div></div><div class='docblock'><p>Is called to get the representation of the value as status code. This status code is returned to the operating system. <a href="../std/process/trait.Termination.html#tymethod.report">Read more</a></p>
</div></div></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><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>