757 lines
85 KiB
HTML
757 lines
85 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `MilliBel` struct in crate `alsa`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, MilliBel">
|
||
|
||
<title>alsa::mixer::MilliBel - 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">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc struct">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'>Struct MilliBel</p><div class="block items"><ul><li><a href="#methods">Methods</a></li><li><a href="#deref-methods">Methods from Deref<Target=i64></a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>alsa</a>::<wbr><a href='index.html'>mixer</a></p><script>window.sidebarCurrent = {name: 'MilliBel', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>alsa</a>::<wbr><a href='index.html'>mixer</a>::<wbr><a class="struct" href=''>MilliBel</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a class='srclink' href='../../src/alsa/mixer.rs.html#95' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct MilliBel(pub <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>);</pre><div class='docblock'><p>Wrapper for a mB (millibel) value.</p>
|
||
|
||
<p>Despite some ALSA functions named "dB", they actually take mB values instead.
|
||
This is a wrapper type to help with those calculations. Its interior is the
|
||
actual mB value.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#97-100' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.to_db' class="method"><span id='to_db.v' class='invisible'><code>fn <a href='#method.to_db' class='fnname'>to_db</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></span></h4>
|
||
<h4 id='method.from_db' class="method"><span id='from_db.v' class='invisible'><code>fn <a href='#method.from_db' class='fnname'>from_db</a>(db: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -> Self</code></span></h4>
|
||
</div><h2 id='deref-methods'>Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></h2><div class='impl-items'><h4 id='method.count_ones' class="method"><span id='count_ones.v' class='invisible'><code>fn <a href='#method.count_ones' class='fnname'>count_ones</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns the number of ones in the binary representation of <code>self</code>.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="op">-</span><span class="number">0b1000_0000i8</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">count_ones</span>(), <span class="number">1</span>);</pre>
|
||
</div><h4 id='method.count_zeros' class="method"><span id='count_zeros.v' class='invisible'><code>fn <a href='#method.count_zeros' class='fnname'>count_zeros</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns the number of zeros in the binary representation of <code>self</code>.</p>
|
||
|
||
<h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="op">-</span><span class="number">0b1000_0000i8</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">count_zeros</span>(), <span class="number">7</span>);</pre>
|
||
</div><h4 id='method.leading_zeros' class="method"><span id='leading_zeros.v' class='invisible'><code>fn <a href='#method.leading_zeros' class='fnname'>leading_zeros</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns the number of leading zeros in the binary representation
|
||
of <code>self</code>.</p>
|
||
|
||
<h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="op">-</span><span class="number">1i16</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">leading_zeros</span>(), <span class="number">0</span>);</pre>
|
||
</div><h4 id='method.trailing_zeros' class="method"><span id='trailing_zeros.v' class='invisible'><code>fn <a href='#method.trailing_zeros' class='fnname'>trailing_zeros</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns the number of trailing zeros in the binary representation
|
||
of <code>self</code>.</p>
|
||
|
||
<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="op">-</span><span class="number">4i8</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">trailing_zeros</span>(), <span class="number">2</span>);</pre>
|
||
</div><h4 id='method.rotate_left' class="method"><span id='rotate_left.v' class='invisible'><code>fn <a href='#method.rotate_left' class='fnname'>rotate_left</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Shifts the bits to the left by a specified amount, <code>n</code>,
|
||
wrapping the truncated bits to the end of the resulting integer.</p>
|
||
|
||
<p>Please note this isn't the same operation as <code><<</code>!</p>
|
||
|
||
<h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">0x0123456789ABCDEFi64</span>;
|
||
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="op">-</span><span class="number">0x76543210FEDCBA99i64</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">rotate_left</span>(<span class="number">32</span>), <span class="ident">m</span>);</pre>
|
||
</div><h4 id='method.rotate_right' class="method"><span id='rotate_right.v' class='invisible'><code>fn <a href='#method.rotate_right' class='fnname'>rotate_right</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Shifts the bits to the right by a specified amount, <code>n</code>,
|
||
wrapping the truncated bits to the beginning of the resulting
|
||
integer.</p>
|
||
|
||
<p>Please note this isn't the same operation as <code>>></code>!</p>
|
||
|
||
<h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">0x0123456789ABCDEFi64</span>;
|
||
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="op">-</span><span class="number">0xFEDCBA987654322i64</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">rotate_right</span>(<span class="number">4</span>), <span class="ident">m</span>);</pre>
|
||
</div><h4 id='method.swap_bytes' class="method"><span id='swap_bytes.v' class='invisible'><code>fn <a href='#method.swap_bytes' class='fnname'>swap_bytes</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Reverses the byte order of the integer.</p>
|
||
|
||
<h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">0x0123456789ABCDEFi64</span>;
|
||
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="op">-</span><span class="number">0x1032547698BADCFFi64</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">swap_bytes</span>(), <span class="ident">m</span>);</pre>
|
||
</div><h4 id='method.to_be' class="method"><span id='to_be.v' class='invisible'><code>fn <a href='#method.to_be' class='fnname'>to_be</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Converts <code>self</code> to big endian from the target's endianness.</p>
|
||
|
||
<p>On big endian this is a no-op. On little endian the bytes are
|
||
swapped.</p>
|
||
|
||
<h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">0x0123456789ABCDEFi64</span>;
|
||
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"big"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">to_be</span>(), <span class="ident">n</span>)
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">to_be</span>(), <span class="ident">n</span>.<span class="ident">swap_bytes</span>())
|
||
}</pre>
|
||
</div><h4 id='method.to_le' class="method"><span id='to_le.v' class='invisible'><code>fn <a href='#method.to_le' class='fnname'>to_le</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Converts <code>self</code> to little endian from the target's endianness.</p>
|
||
|
||
<p>On little endian this is a no-op. On big endian the bytes are
|
||
swapped.</p>
|
||
|
||
<h1 id='examples-8' class='section-header'><a href='#examples-8'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="number">0x0123456789ABCDEFi64</span>;
|
||
|
||
<span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">target_endian</span> <span class="op">=</span> <span class="string">"little"</span>) {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">to_le</span>(), <span class="ident">n</span>)
|
||
} <span class="kw">else</span> {
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">to_le</span>(), <span class="ident">n</span>.<span class="ident">swap_bytes</span>())
|
||
}</pre>
|
||
</div><h4 id='method.checked_add' class="method"><span id='checked_add.v' class='invisible'><code>fn <a href='#method.checked_add' class='fnname'>checked_add</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Checked integer addition. Computes <code>self + other</code>, returning <code>None</code>
|
||
if overflow occurred.</p>
|
||
|
||
<h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">7i16</span>.<span class="ident">checked_add</span>(<span class="number">32760</span>), <span class="prelude-val">Some</span>(<span class="number">32767</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">8i16</span>.<span class="ident">checked_add</span>(<span class="number">32760</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_sub' class="method"><span id='checked_sub.v' class='invisible'><code>fn <a href='#method.checked_sub' class='fnname'>checked_sub</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Checked integer subtraction. Computes <code>self - other</code>, returning
|
||
<code>None</code> if underflow occurred.</p>
|
||
|
||
<h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">127i8</span>).<span class="ident">checked_sub</span>(<span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="op">-</span><span class="number">128</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">checked_sub</span>(<span class="number">1</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_mul' class="method"><span id='checked_mul.v' class='invisible'><code>fn <a href='#method.checked_mul' class='fnname'>checked_mul</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Checked integer multiplication. Computes <code>self * other</code>, returning
|
||
<code>None</code> if underflow or overflow occurred.</p>
|
||
|
||
<h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">6i8</span>.<span class="ident">checked_mul</span>(<span class="number">21</span>), <span class="prelude-val">Some</span>(<span class="number">126</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">6i8</span>.<span class="ident">checked_mul</span>(<span class="number">22</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_div' class="method"><span id='checked_div.v' class='invisible'><code>fn <a href='#method.checked_div' class='fnname'>checked_div</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Checked integer division. Computes <code>self / other</code>, returning <code>None</code>
|
||
if <code>other == 0</code> or the operation results in underflow or overflow.</p>
|
||
|
||
<h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">127i8</span>).<span class="ident">checked_div</span>(<span class="op">-</span><span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="number">127</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">checked_div</span>(<span class="op">-</span><span class="number">1</span>), <span class="prelude-val">None</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="number">1i8</span>).<span class="ident">checked_div</span>(<span class="number">0</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_rem' class="method"><span id='checked_rem.v' class='invisible'><code>fn <a href='#method.checked_rem' class='fnname'>checked_rem</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Checked integer remainder. Computes <code>self % other</code>, returning <code>None</code>
|
||
if <code>other == 0</code> or the operation results in underflow or overflow.</p>
|
||
|
||
<h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">checked_rem</span>(<span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">checked_rem</span>(<span class="number">0</span>), <span class="prelude-val">None</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">checked_rem</span>(<span class="op">-</span><span class="number">1</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_neg' class="method"><span id='checked_neg.v' class='invisible'><code>fn <a href='#method.checked_neg' class='fnname'>checked_neg</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Checked negation. Computes <code>-self</code>, returning <code>None</code> if <code>self == MIN</code>.</p>
|
||
|
||
<h1 id='examples-14' class='section-header'><a href='#examples-14'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">checked_neg</span>(), <span class="prelude-val">Some</span>(<span class="op">-</span><span class="number">5</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">checked_neg</span>(), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_shl' class="method"><span id='checked_shl.v' class='invisible'><code>fn <a href='#method.checked_shl' class='fnname'>checked_shl</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Checked shift left. Computes <code>self << rhs</code>, returning <code>None</code>
|
||
if <code>rhs</code> is larger than or equal to the number of bits in <code>self</code>.</p>
|
||
|
||
<h1 id='examples-15' class='section-header'><a href='#examples-15'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">checked_shl</span>(<span class="number">4</span>), <span class="prelude-val">Some</span>(<span class="number">0x100</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">checked_shl</span>(<span class="number">33</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_shr' class="method"><span id='checked_shr.v' class='invisible'><code>fn <a href='#method.checked_shr' class='fnname'>checked_shr</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Checked shift right. Computes <code>self >> rhs</code>, returning <code>None</code>
|
||
if <code>rhs</code> is larger than or equal to the number of bits in <code>self</code>.</p>
|
||
|
||
<h1 id='examples-16' class='section-header'><a href='#examples-16'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">checked_shr</span>(<span class="number">4</span>), <span class="prelude-val">Some</span>(<span class="number">0x1</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">checked_shr</span>(<span class="number">33</span>), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.checked_abs' class="method"><span id='checked_abs.v' class='invisible'><code>fn <a href='#method.checked_abs' class='fnname'>checked_abs</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code><div class='since' title='Stable since Rust version 1.13.0'>1.13.0</div></span></h4>
|
||
<div class='docblock'><p>Checked absolute value. Computes <code>self.abs()</code>, returning <code>None</code> if
|
||
<code>self == MIN</code>.</p>
|
||
|
||
<h1 id='examples-17' class='section-header'><a href='#examples-17'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">5i32</span>).<span class="ident">checked_abs</span>(), <span class="prelude-val">Some</span>(<span class="number">5</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">checked_abs</span>(), <span class="prelude-val">None</span>);</pre>
|
||
</div><h4 id='method.saturating_add' class="method"><span id='saturating_add.v' class='invisible'><code>fn <a href='#method.saturating_add' class='fnname'>saturating_add</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Saturating integer addition. Computes <code>self + other</code>, saturating at
|
||
the numeric bounds instead of overflowing.</p>
|
||
|
||
<h1 id='examples-18' class='section-header'><a href='#examples-18'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">saturating_add</span>(<span class="number">1</span>), <span class="number">101</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">saturating_add</span>(<span class="number">127</span>), <span class="number">127</span>);</pre>
|
||
</div><h4 id='method.saturating_sub' class="method"><span id='saturating_sub.v' class='invisible'><code>fn <a href='#method.saturating_sub' class='fnname'>saturating_sub</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Saturating integer subtraction. Computes <code>self - other</code>, saturating
|
||
at the numeric bounds instead of overflowing.</p>
|
||
|
||
<h1 id='examples-19' class='section-header'><a href='#examples-19'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">saturating_sub</span>(<span class="number">127</span>), <span class="op">-</span><span class="number">27</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">100i8</span>).<span class="ident">saturating_sub</span>(<span class="number">127</span>), <span class="op">-</span><span class="number">128</span>);</pre>
|
||
</div><h4 id='method.saturating_mul' class="method"><span id='saturating_mul.v' class='invisible'><code>fn <a href='#method.saturating_mul' class='fnname'>saturating_mul</a>(self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Saturating integer multiplication. Computes <code>self * other</code>,
|
||
saturating at the numeric bounds instead of overflowing.</p>
|
||
|
||
<h1 id='examples-20' class='section-header'><a href='#examples-20'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i32</span>.<span class="ident">saturating_mul</span>(<span class="number">127</span>), <span class="number">12700</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="number">1i32</span> <span class="op"><<</span> <span class="number">23</span>).<span class="ident">saturating_mul</span>(<span class="number">1</span> <span class="op"><<</span> <span class="number">23</span>), <span class="ident">i32</span>::<span class="ident">MAX</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1i32</span> <span class="op"><<</span> <span class="number">23</span>).<span class="ident">saturating_mul</span>(<span class="number">1</span> <span class="op"><<</span> <span class="number">23</span>), <span class="ident">i32</span>::<span class="ident">MIN</span>);</pre>
|
||
</div><h4 id='method.wrapping_add' class="method"><span id='wrapping_add.v' class='invisible'><code>fn <a href='#method.wrapping_add' class='fnname'>wrapping_add</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) addition. Computes <code>self + other</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<h1 id='examples-21' class='section-header'><a href='#examples-21'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">wrapping_add</span>(<span class="number">27</span>), <span class="number">127</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">wrapping_add</span>(<span class="number">127</span>), <span class="op">-</span><span class="number">29</span>);</pre>
|
||
</div><h4 id='method.wrapping_sub' class="method"><span id='wrapping_sub.v' class='invisible'><code>fn <a href='#method.wrapping_sub' class='fnname'>wrapping_sub</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) subtraction. Computes <code>self - other</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<h1 id='examples-22' class='section-header'><a href='#examples-22'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0i8</span>.<span class="ident">wrapping_sub</span>(<span class="number">127</span>), <span class="op">-</span><span class="number">127</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">2i8</span>).<span class="ident">wrapping_sub</span>(<span class="number">127</span>), <span class="number">127</span>);</pre>
|
||
</div><h4 id='method.wrapping_mul' class="method"><span id='wrapping_mul.v' class='invisible'><code>fn <a href='#method.wrapping_mul' class='fnname'>wrapping_mul</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) multiplication. Computes <code>self * other</code>, wrapping around at the boundary of the type.</p>
|
||
|
||
<h1 id='examples-23' class='section-header'><a href='#examples-23'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">10i8</span>.<span class="ident">wrapping_mul</span>(<span class="number">12</span>), <span class="number">120</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">11i8</span>.<span class="ident">wrapping_mul</span>(<span class="number">12</span>), <span class="op">-</span><span class="number">124</span>);</pre>
|
||
</div><h4 id='method.wrapping_div' class="method"><span id='wrapping_div.v' class='invisible'><code>fn <a href='#method.wrapping_div' class='fnname'>wrapping_div</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) division. Computes <code>self / other</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<p>The only case where such wrapping can occur is when one
|
||
divides <code>MIN / -1</code> on a signed type (where <code>MIN</code> is the
|
||
negative minimal value for the type); this is equivalent
|
||
to <code>-MIN</code>, a positive value that is too large to represent
|
||
in the type. In such a case, this function returns <code>MIN</code>
|
||
itself.</p>
|
||
|
||
<h1 id='panics' class='section-header'><a href='#panics'>Panics</a></h1>
|
||
<p>This function will panic if <code>rhs</code> is 0.</p>
|
||
|
||
<h1 id='examples-24' class='section-header'><a href='#examples-24'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100u8</span>.<span class="ident">wrapping_div</span>(<span class="number">10</span>), <span class="number">10</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_div</span>(<span class="op">-</span><span class="number">1</span>), <span class="op">-</span><span class="number">128</span>);</pre>
|
||
</div><h4 id='method.wrapping_rem' class="method"><span id='wrapping_rem.v' class='invisible'><code>fn <a href='#method.wrapping_rem' class='fnname'>wrapping_rem</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) remainder. Computes <code>self % other</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<p>Such wrap-around never actually occurs mathematically;
|
||
implementation artifacts make <code>x % y</code> invalid for <code>MIN / -1</code> on a signed type (where <code>MIN</code> is the negative
|
||
minimal value). In such a case, this function returns <code>0</code>.</p>
|
||
|
||
<h1 id='panics-1' class='section-header'><a href='#panics-1'>Panics</a></h1>
|
||
<p>This function will panic if <code>rhs</code> is 0.</p>
|
||
|
||
<h1 id='examples-25' class='section-header'><a href='#examples-25'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">wrapping_rem</span>(<span class="number">10</span>), <span class="number">0</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_rem</span>(<span class="op">-</span><span class="number">1</span>), <span class="number">0</span>);</pre>
|
||
</div><h4 id='method.wrapping_neg' class="method"><span id='wrapping_neg.v' class='invisible'><code>fn <a href='#method.wrapping_neg' class='fnname'>wrapping_neg</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) negation. Computes <code>-self</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<p>The only case where such wrapping can occur is when one
|
||
negates <code>MIN</code> on a signed type (where <code>MIN</code> is the
|
||
negative minimal value for the type); this is a positive
|
||
value that is too large to represent in the type. In such
|
||
a case, this function returns <code>MIN</code> itself.</p>
|
||
|
||
<h1 id='examples-26' class='section-header'><a href='#examples-26'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">wrapping_neg</span>(), <span class="op">-</span><span class="number">100</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_neg</span>(), <span class="op">-</span><span class="number">128</span>);</pre>
|
||
</div><h4 id='method.wrapping_shl' class="method"><span id='wrapping_shl.v' class='invisible'><code>fn <a href='#method.wrapping_shl' class='fnname'>wrapping_shl</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div></span></h4>
|
||
<div class='docblock'><p>Panic-free bitwise shift-left; yields <code>self << mask(rhs)</code>,
|
||
where <code>mask</code> removes any high-order bits of <code>rhs</code> that
|
||
would cause the shift to exceed the bitwidth of the type.</p>
|
||
|
||
<p>Note that this is <em>not</em> the same as a rotate-left; the
|
||
RHS of a wrapping shift-left is restricted to the range
|
||
of the type, rather than the bits shifted out of the LHS
|
||
being returned to the other end. The primitive integer
|
||
types all implement a <code>rotate_left</code> function, which may
|
||
be what you want instead.</p>
|
||
|
||
<h1 id='examples-27' class='section-header'><a href='#examples-27'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1i8</span>).<span class="ident">wrapping_shl</span>(<span class="number">7</span>), <span class="op">-</span><span class="number">128</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1i8</span>).<span class="ident">wrapping_shl</span>(<span class="number">8</span>), <span class="op">-</span><span class="number">1</span>);</pre>
|
||
</div><h4 id='method.wrapping_shr' class="method"><span id='wrapping_shr.v' class='invisible'><code>fn <a href='#method.wrapping_shr' class='fnname'>wrapping_shr</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.2.0'>1.2.0</div></span></h4>
|
||
<div class='docblock'><p>Panic-free bitwise shift-right; yields <code>self >> mask(rhs)</code>,
|
||
where <code>mask</code> removes any high-order bits of <code>rhs</code> that
|
||
would cause the shift to exceed the bitwidth of the type.</p>
|
||
|
||
<p>Note that this is <em>not</em> the same as a rotate-right; the
|
||
RHS of a wrapping shift-right is restricted to the range
|
||
of the type, rather than the bits shifted out of the LHS
|
||
being returned to the other end. The primitive integer
|
||
types all implement a <code>rotate_right</code> function, which may
|
||
be what you want instead.</p>
|
||
|
||
<h1 id='examples-28' class='section-header'><a href='#examples-28'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_shr</span>(<span class="number">7</span>), <span class="op">-</span><span class="number">1</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_shr</span>(<span class="number">8</span>), <span class="op">-</span><span class="number">128</span>);</pre>
|
||
</div><h4 id='method.wrapping_abs' class="method"><span id='wrapping_abs.v' class='invisible'><code>fn <a href='#method.wrapping_abs' class='fnname'>wrapping_abs</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.13.0'>1.13.0</div></span></h4>
|
||
<div class='docblock'><p>Wrapping (modular) absolute value. Computes <code>self.abs()</code>,
|
||
wrapping around at the boundary of the type.</p>
|
||
|
||
<p>The only case where such wrapping can occur is when one takes
|
||
the absolute value of the negative minimal value for the type
|
||
this is a positive value that is too large to represent in the
|
||
type. In such a case, this function returns <code>MIN</code> itself.</p>
|
||
|
||
<h1 id='examples-29' class='section-header'><a href='#examples-29'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">100i8</span>.<span class="ident">wrapping_abs</span>(), <span class="number">100</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">100i8</span>).<span class="ident">wrapping_abs</span>(), <span class="number">100</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_abs</span>(), <span class="op">-</span><span class="number">128</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">wrapping_abs</span>() <span class="kw">as</span> <span class="ident">u8</span>, <span class="number">128</span>);</pre>
|
||
</div><h4 id='method.overflowing_add' class="method"><span id='overflowing_add.v' class='invisible'><code>fn <a href='#method.overflowing_add' class='fnname'>overflowing_add</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Calculates <code>self</code> + <code>rhs</code></p>
|
||
|
||
<p>Returns a tuple of the addition along with a boolean indicating
|
||
whether an arithmetic overflow would occur. If an overflow would
|
||
have occurred then the wrapped value is returned.</p>
|
||
|
||
<h1 id='examples-30' class='section-header'><a href='#examples-30'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">overflowing_add</span>(<span class="number">2</span>), (<span class="number">7</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MAX</span>.<span class="ident">overflowing_add</span>(<span class="number">1</span>), (<span class="ident">i32</span>::<span class="ident">MIN</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_sub' class="method"><span id='overflowing_sub.v' class='invisible'><code>fn <a href='#method.overflowing_sub' class='fnname'>overflowing_sub</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Calculates <code>self</code> - <code>rhs</code></p>
|
||
|
||
<p>Returns a tuple of the subtraction along with a boolean indicating
|
||
whether an arithmetic overflow would occur. If an overflow would
|
||
have occurred then the wrapped value is returned.</p>
|
||
|
||
<h1 id='examples-31' class='section-header'><a href='#examples-31'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">overflowing_sub</span>(<span class="number">2</span>), (<span class="number">3</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">overflowing_sub</span>(<span class="number">1</span>), (<span class="ident">i32</span>::<span class="ident">MAX</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_mul' class="method"><span id='overflowing_mul.v' class='invisible'><code>fn <a href='#method.overflowing_mul' class='fnname'>overflowing_mul</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Calculates the multiplication of <code>self</code> and <code>rhs</code>.</p>
|
||
|
||
<p>Returns a tuple of the multiplication along with a boolean
|
||
indicating whether an arithmetic overflow would occur. If an
|
||
overflow would have occurred then the wrapped value is returned.</p>
|
||
|
||
<h1 id='examples-32' class='section-header'><a href='#examples-32'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">overflowing_mul</span>(<span class="number">2</span>), (<span class="number">10</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1_000_000_000i32</span>.<span class="ident">overflowing_mul</span>(<span class="number">10</span>), (<span class="number">1410065408</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_div' class="method"><span id='overflowing_div.v' class='invisible'><code>fn <a href='#method.overflowing_div' class='fnname'>overflowing_div</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Calculates the divisor when <code>self</code> is divided by <code>rhs</code>.</p>
|
||
|
||
<p>Returns a tuple of the divisor along with a boolean indicating
|
||
whether an arithmetic overflow would occur. If an overflow would
|
||
occur then self is returned.</p>
|
||
|
||
<h1 id='panics-2' class='section-header'><a href='#panics-2'>Panics</a></h1>
|
||
<p>This function will panic if <code>rhs</code> is 0.</p>
|
||
|
||
<h1 id='examples-33' class='section-header'><a href='#examples-33'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">overflowing_div</span>(<span class="number">2</span>), (<span class="number">2</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">overflowing_div</span>(<span class="op">-</span><span class="number">1</span>), (<span class="ident">i32</span>::<span class="ident">MIN</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_rem' class="method"><span id='overflowing_rem.v' class='invisible'><code>fn <a href='#method.overflowing_rem' class='fnname'>overflowing_rem</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Calculates the remainder when <code>self</code> is divided by <code>rhs</code>.</p>
|
||
|
||
<p>Returns a tuple of the remainder after dividing along with a boolean
|
||
indicating whether an arithmetic overflow would occur. If an
|
||
overflow would occur then 0 is returned.</p>
|
||
|
||
<h1 id='panics-3' class='section-header'><a href='#panics-3'>Panics</a></h1>
|
||
<p>This function will panic if <code>rhs</code> is 0.</p>
|
||
|
||
<h1 id='examples-34' class='section-header'><a href='#examples-34'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5i32</span>.<span class="ident">overflowing_rem</span>(<span class="number">2</span>), (<span class="number">1</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">overflowing_rem</span>(<span class="op">-</span><span class="number">1</span>), (<span class="number">0</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_neg' class="method"><span id='overflowing_neg.v' class='invisible'><code>fn <a href='#method.overflowing_neg' class='fnname'>overflowing_neg</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Negates self, overflowing if this is equal to the minimum value.</p>
|
||
|
||
<p>Returns a tuple of the negated version of self along with a boolean
|
||
indicating whether an overflow happened. If <code>self</code> is the minimum
|
||
value (e.g. <code>i32::MIN</code> for values of type <code>i32</code>), then the minimum
|
||
value will be returned again and <code>true</code> will be returned for an
|
||
overflow happening.</p>
|
||
|
||
<h1 id='examples-35' class='section-header'><a href='#examples-35'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">i32</span>;
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">2i32</span>.<span class="ident">overflowing_neg</span>(), (<span class="op">-</span><span class="number">2</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i32</span>::<span class="ident">MIN</span>.<span class="ident">overflowing_neg</span>(), (<span class="ident">i32</span>::<span class="ident">MIN</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_shl' class="method"><span id='overflowing_shl.v' class='invisible'><code>fn <a href='#method.overflowing_shl' class='fnname'>overflowing_shl</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Shifts self left by <code>rhs</code> bits.</p>
|
||
|
||
<p>Returns a tuple of the shifted version of self along with a boolean
|
||
indicating whether the shift value was larger than or equal to the
|
||
number of bits. If the shift value is too large, then value is
|
||
masked (N-1) where N is the number of bits, and this value is then
|
||
used to perform the shift.</p>
|
||
|
||
<h1 id='examples-36' class='section-header'><a href='#examples-36'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">overflowing_shl</span>(<span class="number">4</span>), (<span class="number">0x100</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">overflowing_shl</span>(<span class="number">36</span>), (<span class="number">0x100</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_shr' class="method"><span id='overflowing_shr.v' class='invisible'><code>fn <a href='#method.overflowing_shr' class='fnname'>overflowing_shr</a>(self, rhs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
|
||
<div class='docblock'><p>Shifts self right by <code>rhs</code> bits.</p>
|
||
|
||
<p>Returns a tuple of the shifted version of self along with a boolean
|
||
indicating whether the shift value was larger than or equal to the
|
||
number of bits. If the shift value is too large, then value is
|
||
masked (N-1) where N is the number of bits, and this value is then
|
||
used to perform the shift.</p>
|
||
|
||
<h1 id='examples-37' class='section-header'><a href='#examples-37'>Examples</a></h1>
|
||
<p>Basic usage</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">overflowing_shr</span>(<span class="number">4</span>), (<span class="number">0x1</span>, <span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0x10i32</span>.<span class="ident">overflowing_shr</span>(<span class="number">36</span>), (<span class="number">0x1</span>, <span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.overflowing_abs' class="method"><span id='overflowing_abs.v' class='invisible'><code>fn <a href='#method.overflowing_abs' class='fnname'>overflowing_abs</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><div class='since' title='Stable since Rust version 1.13.0'>1.13.0</div></span></h4>
|
||
<div class='docblock'><p>Computes the absolute value of <code>self</code>.</p>
|
||
|
||
<p>Returns a tuple of the absolute version of self along with a
|
||
boolean indicating whether an overflow happened. If self is the
|
||
minimum value (e.g. i32::MIN for values of type i32), then the
|
||
minimum value will be returned again and true will be returned for
|
||
an overflow happening.</p>
|
||
|
||
<h1 id='examples-38' class='section-header'><a href='#examples-38'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">10i8</span>.<span class="ident">overflowing_abs</span>(), (<span class="number">10</span>,<span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">10i8</span>).<span class="ident">overflowing_abs</span>(), (<span class="number">10</span>,<span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">128i8</span>).<span class="ident">overflowing_abs</span>(), (<span class="op">-</span><span class="number">128</span>,<span class="bool-val">true</span>));</pre>
|
||
</div><h4 id='method.pow' class="method"><span id='pow.v' class='invisible'><code>fn <a href='#method.pow' class='fnname'>pow</a>(self, exp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Raises self to the power of <code>exp</code>, using exponentiation by squaring.</p>
|
||
|
||
<h1 id='examples-39' class='section-header'><a href='#examples-39'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">x</span>: <span class="ident">i32</span> <span class="op">=</span> <span class="number">2</span>; <span class="comment">// or any other integer type</span>
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">pow</span>(<span class="number">4</span>), <span class="number">16</span>);</pre>
|
||
</div><h4 id='method.abs' class="method"><span id='abs.v' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Computes the absolute value of <code>self</code>.</p>
|
||
|
||
<h1 id='overflow-behavior' class='section-header'><a href='#overflow-behavior'>Overflow behavior</a></h1>
|
||
<p>The absolute value of <code>i32::min_value()</code> cannot be represented as an
|
||
<code>i32</code>, and attempting to calculate it will cause an overflow. This
|
||
means that code in debug mode will trigger a panic on this case and
|
||
optimized code will return <code>i32::min_value()</code> without a panic.</p>
|
||
|
||
<h1 id='examples-40' class='section-header'><a href='#examples-40'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">10i8</span>.<span class="ident">abs</span>(), <span class="number">10</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">10i8</span>).<span class="ident">abs</span>(), <span class="number">10</span>);</pre>
|
||
</div><h4 id='method.signum' class="method"><span id='signum.v' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns a number representing sign of <code>self</code>.</p>
|
||
|
||
<ul>
|
||
<li><code>0</code> if the number is zero</li>
|
||
<li><code>1</code> if the number is positive</li>
|
||
<li><code>-1</code> if the number is negative</li>
|
||
</ul>
|
||
|
||
<h1 id='examples-41' class='section-header'><a href='#examples-41'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">10i8</span>.<span class="ident">signum</span>(), <span class="number">1</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0i8</span>.<span class="ident">signum</span>(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">10i8</span>).<span class="ident">signum</span>(), <span class="op">-</span><span class="number">1</span>);</pre>
|
||
</div><h4 id='method.is_positive' class="method"><span id='is_positive.v' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns <code>true</code> if <code>self</code> is positive and <code>false</code> if the number
|
||
is zero or negative.</p>
|
||
|
||
<h1 id='examples-42' class='section-header'><a href='#examples-42'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="number">10i8</span>.<span class="ident">is_positive</span>());
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span>(<span class="op">-</span><span class="number">10i8</span>).<span class="ident">is_positive</span>());</pre>
|
||
</div><h4 id='method.is_negative' class="method"><span id='is_negative.v' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Returns <code>true</code> if <code>self</code> is negative and <code>false</code> if the number
|
||
is zero or positive.</p>
|
||
|
||
<h1 id='examples-43' class='section-header'><a href='#examples-43'>Examples</a></h1>
|
||
<p>Basic usage:</p>
|
||
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">10i8</span>).<span class="ident">is_negative</span>());
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="number">10i8</span>.<span class="ident">is_negative</span>());</pre>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span></h4>
|
||
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/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'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
|
||
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
|
||
<div class='docblock'><p>Formats the value using the given formatter.</p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></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="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h4>
|
||
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></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="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
||
</div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></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><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
||
</div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></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><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
||
</div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></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>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
||
</div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></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>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&self, __arg_0: &<a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code></span></h4>
|
||
<div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
|
||
</div><h4 id='method.max' class="method"><span id='max.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max' class='fnname'>max</a>(self, other: Self) -> Self</code></span></h4>
|
||
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ord_max_min</code>)</div></div><div class='docblock'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></p>
|
||
</div><h4 id='method.min' class="method"><span id='min.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min' class='fnname'>min</a>(self, other: Self) -> Self</code></span></h4>
|
||
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ord_max_min</code>)</div></div><div class='docblock'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#94' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a><__H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, __arg_0: &mut __H)</code></span></h4>
|
||
<div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/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'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a><H>(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[Self]</a>, state: &mut H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div></span></h4>
|
||
<div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#102-105' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span></h4>
|
||
<div class='docblock'><p>The resulting type after dereferencing</p>
|
||
</div><h4 id='method.deref' class="method"><span id='deref.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span></h4>
|
||
<div class='docblock'><p>The method called to dereference a value</p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#107-110' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='associatedtype.Output' class="type"><span id='Output.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/arith/trait.Add.html#associatedtype.Output' class="type">Output</a> = <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span></h4>
|
||
<div class='docblock'><p>The resulting type after applying the <code>+</code> operator</p>
|
||
</div><h4 id='method.add' class="method"><span id='add.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/arith/trait.Add.html#tymethod.add' class='fnname'>add</a>(self, rhs: Self) -> Self</code></span></h4>
|
||
<div class='docblock'><p>The method for the <code>+</code> operator</p>
|
||
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a> for <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alsa/mixer.rs.html#112-115' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='associatedtype.Output-1' class="type"><span id='Output.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/arith/trait.Sub.html#associatedtype.Output' class="type">Output</a> = <a class="struct" href="../../alsa/mixer/struct.MilliBel.html" title="struct alsa::mixer::MilliBel">MilliBel</a></code></span></h4>
|
||
<div class='docblock'><p>The resulting type after applying the <code>-</code> operator</p>
|
||
</div><h4 id='method.sub' class="method"><span id='sub.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/arith/trait.Sub.html#tymethod.sub' class='fnname'>sub</a>(self, rhs: Self) -> Self</code></span></h4>
|
||
<div class='docblock'><p>The method for the <code>-</code> operator</p>
|
||
</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>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
<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 = "alsa";
|
||
</script>
|
||
<script src="../../main.js"></script>
|
||
<script defer src="../../search-index.js"></script>
|
||
</body>
|
||
</html> |