456 lines
98 KiB
HTML
456 lines
98 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 `Integer` trait in crate `num`.">
|
|||
|
<meta name="keywords" content="rust, rustlang, rust-lang, Integer">
|
|||
|
|
|||
|
<title>num::Integer - 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="../main.css" id="themeStyle">
|
|||
|
<script src="../storage.js"></script>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</head>
|
|||
|
<body class="rustdoc trait">
|
|||
|
<!--[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">☰</div>
|
|||
|
|
|||
|
<p class='location'>Trait Integer</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.div_floor">div_floor</a><a href="#tymethod.mod_floor">mod_floor</a><a href="#tymethod.gcd">gcd</a><a href="#tymethod.lcm">lcm</a><a href="#tymethod.divides">divides</a><a href="#tymethod.is_multiple_of">is_multiple_of</a><a href="#tymethod.is_even">is_even</a><a href="#tymethod.is_odd">is_odd</a><a href="#tymethod.div_rem">div_rem</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.div_mod_floor">div_mod_floor</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Integer">usize</a><a href="#impl-Integer">u16</a><a href="#impl-Integer">isize</a><a href="#impl-Integer">i32</a><a href="#impl-Integer">u8</a><a href="#impl-Integer">u32</a><a href="#impl-Integer">i8</a><a href="#impl-Integer">i16</a><a href="#impl-Integer">u64</a><a href="#impl-Integer">i64</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>num</a></p><script>window.sidebarCurrent = {name: 'Integer', ty: 'trait', 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">
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
</nav>
|
|||
|
|
|||
|
<section id='main' class="content">
|
|||
|
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>num</a>::<wbr><a class="trait" href=''>Integer</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/num_integer/lib.rs.html#34-175' title='goto source code'>[src]</a></span></h1>
|
|||
|
<pre class='rust trait'>pub trait Integer: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><Self> + <a class="trait" href="../num/trait.Num.html" title="trait num::Num">Num</a> {
|
|||
|
fn <a href='#tymethod.div_floor' class='fnname'>div_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.mod_floor' class='fnname'>mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.gcd' class='fnname'>gcd</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.lcm' class='fnname'>lcm</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.divides' class='fnname'>divides</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
|
|||
|
<div class='item-spacer'></div> fn <a href='#tymethod.div_rem' class='fnname'>div_rem</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;
|
|||
|
|
|||
|
fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> { ... }
|
|||
|
}</pre>
|
|||
|
<h2 id='required-methods' class='small-section-header'>
|
|||
|
Required Methods<a href='#required-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='tymethod.div_floor' class='method'><span id='div_floor.v' class='invisible'><code>fn <a href='#tymethod.div_floor' class='fnname'>div_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self</code></span></h3><div class='docblock'><p>Floored integer division.</p>
|
|||
|
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_floor</span>(<span class="op">&</span> <span class="number">3</span>) <span class="op">==</span> <span class="number">2</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>) <span class="op">==</span> <span class="op">-</span><span class="number">3</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">div_floor</span>(<span class="op">&</span> <span class="number">3</span>) <span class="op">==</span> <span class="op">-</span><span class="number">3</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">div_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>) <span class="op">==</span> <span class="number">2</span>);
|
|||
|
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_floor</span>(<span class="op">&</span> <span class="number">2</span>) <span class="op">==</span> <span class="number">0</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>) <span class="op">==</span> <span class="op">-</span><span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">div_floor</span>(<span class="op">&</span> <span class="number">2</span>) <span class="op">==</span> <span class="op">-</span><span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">div_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>) <span class="op">==</span> <span class="number">0</span>);</pre>
|
|||
|
</div><h3 id='tymethod.mod_floor' class='method'><span id='mod_floor.v' class='invisible'><code>fn <a href='#tymethod.mod_floor' class='fnname'>mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self</code></span></h3><div class='docblock'><p>Floored integer modulo, satisfying:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">n</span>.<span class="ident">div_floor</span>(<span class="kw-2">&</span><span class="ident">d</span>) <span class="op">*</span> <span class="ident">d</span> <span class="op">+</span> <span class="ident">n</span>.<span class="ident">mod_floor</span>(<span class="kw-2">&</span><span class="ident">d</span>) <span class="op">==</span> <span class="ident">n</span>)</pre>
|
|||
|
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">mod_floor</span>(<span class="op">&</span> <span class="number">3</span>) <span class="op">==</span> <span class="number">2</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>) <span class="op">==</span> <span class="op">-</span><span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">mod_floor</span>(<span class="op">&</span> <span class="number">3</span>) <span class="op">==</span> <span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>) <span class="op">==</span> <span class="op">-</span><span class="number">2</span>);
|
|||
|
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">mod_floor</span>(<span class="op">&</span> <span class="number">2</span>) <span class="op">==</span> <span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>) <span class="op">==</span> <span class="op">-</span><span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">mod_floor</span>(<span class="op">&</span> <span class="number">2</span>) <span class="op">==</span> <span class="number">1</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>) <span class="op">==</span> <span class="op">-</span><span class="number">1</span>);</pre>
|
|||
|
</div><h3 id='tymethod.gcd' class='method'><span id='gcd.v' class='invisible'><code>fn <a href='#tymethod.gcd' class='fnname'>gcd</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self</code></span></h3><div class='docblock'><p>Greatest Common Divisor (GCD).</p>
|
|||
|
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">6</span>.<span class="ident">gcd</span>(<span class="kw-2">&</span><span class="number">8</span>), <span class="number">2</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">7</span>.<span class="ident">gcd</span>(<span class="kw-2">&</span><span class="number">3</span>), <span class="number">1</span>);</pre>
|
|||
|
</div><h3 id='tymethod.lcm' class='method'><span id='lcm.v' class='invisible'><code>fn <a href='#tymethod.lcm' class='fnname'>lcm</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> Self</code></span></h3><div class='docblock'><p>Lowest Common Multiple (LCM).</p>
|
|||
|
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">7</span>.<span class="ident">lcm</span>(<span class="kw-2">&</span><span class="number">3</span>), <span class="number">21</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">2</span>.<span class="ident">lcm</span>(<span class="kw-2">&</span><span class="number">4</span>), <span class="number">4</span>);</pre>
|
|||
|
</div><h3 id='tymethod.divides' class='method'><span id='divides.v' class='invisible'><code>fn <a href='#tymethod.divides' class='fnname'>divides</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h3 id='tymethod.is_multiple_of' class='method'><span id='is_multiple_of.v' class='invisible'><code>fn <a href='#tymethod.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if <code>self</code> is a multiple of <code>other</code>.</p>
|
|||
|
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">9</span>.<span class="ident">is_multiple_of</span>(<span class="kw-2">&</span><span class="number">3</span>), <span class="bool-val">true</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">3</span>.<span class="ident">is_multiple_of</span>(<span class="kw-2">&</span><span class="number">9</span>), <span class="bool-val">false</span>);</pre>
|
|||
|
</div><h3 id='tymethod.is_even' class='method'><span id='is_even.v' class='invisible'><code>fn <a href='#tymethod.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is even.</p>
|
|||
|
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">3</span>.<span class="ident">is_even</span>(), <span class="bool-val">false</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">4</span>.<span class="ident">is_even</span>(), <span class="bool-val">true</span>);</pre>
|
|||
|
</div><h3 id='tymethod.is_odd' class='method'><span id='is_odd.v' class='invisible'><code>fn <a href='#tymethod.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is odd.</p>
|
|||
|
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">3</span>.<span class="ident">is_odd</span>(), <span class="bool-val">true</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">4</span>.<span class="ident">is_odd</span>(), <span class="bool-val">false</span>);</pre>
|
|||
|
</div><h3 id='tymethod.div_rem' class='method'><span id='div_rem.v' class='invisible'><code>fn <a href='#tymethod.div_rem' class='fnname'>div_rem</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h3><div class='docblock'><p>Simultaneous truncated integer division and modulus.
|
|||
|
Returns <code>(quotient, remainder)</code>.</p>
|
|||
|
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_rem</span>( <span class="kw-2">&</span><span class="number">3</span>), ( <span class="number">2</span>, <span class="number">2</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_rem</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>), (<span class="op">-</span><span class="number">2</span>, <span class="number">2</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">div_rem</span>( <span class="kw-2">&</span><span class="number">3</span>), (<span class="op">-</span><span class="number">2</span>, <span class="op">-</span><span class="number">2</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">div_rem</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>), ( <span class="number">2</span>, <span class="op">-</span><span class="number">2</span>));
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_rem</span>( <span class="kw-2">&</span><span class="number">2</span>), ( <span class="number">0</span>, <span class="number">1</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_rem</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>), ( <span class="number">0</span>, <span class="number">1</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">div_rem</span>( <span class="kw-2">&</span><span class="number">2</span>), ( <span class="number">0</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">1</span>).<span class="ident">div_rem</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>), ( <span class="number">0</span>, <span class="op">-</span><span class="number">1</span>));</pre>
|
|||
|
</div></div>
|
|||
|
<h2 id='provided-methods' class='small-section-header'>
|
|||
|
Provided Methods<a href='#provided-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='method.div_mod_floor' class='method'><span id='div_mod_floor.v' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h3><div class='docblock'><p>Simultaneous floored integer division and modulus.
|
|||
|
Returns <code>(quotient, remainder)</code>.</p>
|
|||
|
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_mod_floor</span>( <span class="kw-2">&</span><span class="number">3</span>), ( <span class="number">2</span>, <span class="number">2</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">8</span>).<span class="ident">div_mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>), (<span class="op">-</span><span class="number">3</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">8</span>).<span class="ident">div_mod_floor</span>( <span class="kw-2">&</span><span class="number">3</span>), (<span class="op">-</span><span class="number">3</span>, <span class="number">1</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">8</span>).<span class="ident">div_mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">3</span>), ( <span class="number">2</span>, <span class="op">-</span><span class="number">2</span>));
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_mod_floor</span>( <span class="kw-2">&</span><span class="number">2</span>), ( <span class="number">0</span>, <span class="number">1</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(( <span class="number">1</span>).<span class="ident">div_mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>), (<span class="op">-</span><span class="number">1</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">1</span>).<span class="ident">div_mod_floor</span>( <span class="kw-2">&</span><span class="number">2</span>), (<span class="op">-</span><span class="number">1</span>, <span class="number">1</span>));
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>((<span class="op">-</span><span class="number">1</span>).<span class="ident">div_mod_floor</span>(<span class="kw-2">&</span><span class="op">-</span><span class="number">2</span>), ( <span class="number">0</span>, <span class="op">-</span><span class="number">1</span>));</pre>
|
|||
|
</div></div>
|
|||
|
<h2 id='foreign-impls' class='small-section-header'>
|
|||
|
Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl-Integer' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a href='#impl-Integer' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#515-587' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor' class="method"><span id='div_floor.v-1' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#518-520' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer division. Returns the same result as <code>div</code> (<code>/</code>).</p>
|
|||
|
</div><h4 id='method.mod_floor' class="method"><span id='mod_floor.v-1' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer modulo operation. Returns the same result as <code>rem</code> (<code>%</code>).</p>
|
|||
|
</div><h4 id='method.gcd' class="method"><span id='gcd.v-1' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#530-550' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and <code>other</code></p>
|
|||
|
</div><h4 id='method.lcm' class="method"><span id='lcm.v-1' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#554-556' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and <code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides' class="method"><span id='divides.v-1' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#560-562' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of' class="method"><span id='is_multiple_of.v-1' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#566-568' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even' class="method"><span id='is_even.v-1' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#572-574' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.is_odd' class="method"><span id='is_odd.v-1' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#578-580' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.div_rem' class="method"><span id='div_rem.v-1' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#584-586' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div><h4 id='method.div_mod_floor-1' class="method"><span id='div_mod_floor.v-1' class='invisible'><code>fn <a href='../num/trait.Integer.html#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#172-174' title='goto source code'>[src]</a></span></h4>
|
|||
|
</div></span><h3 id='impl-Integer-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code><a href='#impl-Integer-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#515-587' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-1' class="method"><span id='div_floor.v-2' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#518-520' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer division. Returns the same result as <code>div</code> (<code>/</code>).</p>
|
|||
|
</div><h4 id='method.mod_floor-1' class="method"><span id='mod_floor.v-2' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer modulo operation. Returns the same result as <code>rem</code> (<code>%</code>).</p>
|
|||
|
</div><h4 id='method.gcd-1' class="method"><span id='gcd.v-2' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#530-550' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and <code>other</code></p>
|
|||
|
</div><h4 id='method.lcm-1' class="method"><span id='lcm.v-2' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#554-556' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and <code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-1' class="method"><span id='divides.v-2' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#560-562' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-1' class="method"><span id='is_multiple_of.v-2' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#566-568' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-1' class="method"><span id='is_even.v-2' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#572-574' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.is_odd-1' class="method"><span id='is_odd.v-2' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#578-580' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.div_rem-1' class="method"><span id='div_rem.v-2' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</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.u16.html">u16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#584-586' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div><h4 id='method.div_mod_floor-2' class="method"><span id='div_mod_floor.v-2' class='invisible'><code>fn <a href='../num/trait.Integer.html#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#172-174' title='goto source code'>[src]</a></span></h4>
|
|||
|
</div></span><h3 id='impl-Integer-2' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href='#impl-Integer-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#212-323' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-2' class="method"><span id='div_floor.v-3' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#215-223' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer division</p>
|
|||
|
</div><h4 id='method.mod_floor-2' class="method"><span id='mod_floor.v-3' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#227-235' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer modulo</p>
|
|||
|
</div><h4 id='method.div_mod_floor-3' class="method"><span id='div_mod_floor.v-3' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</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.isize.html">isize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#239-247' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates <code>div_floor</code> and <code>mod_floor</code> simultaneously</p>
|
|||
|
</div><h4 id='method.gcd-2' class="method"><span id='gcd.v-3' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#252-288' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and
|
|||
|
<code>other</code>. The result is always positive.</p>
|
|||
|
</div><h4 id='method.lcm-2' class="method"><span id='lcm.v-3' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#293-296' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and
|
|||
|
<code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-2' class="method"><span id='divides.v-3' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#300-302' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-2' class="method"><span id='is_multiple_of.v-3' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#306-308' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-2' class="method"><span id='is_even.v-3' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#312' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.is_odd-2' class="method"><span id='is_odd.v-3' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#316' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.div_rem-2' class="method"><span id='div_rem.v-3' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</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.isize.html">isize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#320-322' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div></div></span><h3 id='impl-Integer-3' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code><a href='#impl-Integer-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#212-323' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-3' class="method"><span id='div_floor.v-4' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#215-223' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer division</p>
|
|||
|
</div><h4 id='method.mod_floor-3' class="method"><span id='mod_floor.v-4' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#227-235' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer modulo</p>
|
|||
|
</div><h4 id='method.div_mod_floor-4' class="method"><span id='div_mod_floor.v-4' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</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.i32.html">i32</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#239-247' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates <code>div_floor</code> and <code>mod_floor</code> simultaneously</p>
|
|||
|
</div><h4 id='method.gcd-3' class="method"><span id='gcd.v-4' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#252-288' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and
|
|||
|
<code>other</code>. The result is always positive.</p>
|
|||
|
</div><h4 id='method.lcm-3' class="method"><span id='lcm.v-4' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#293-296' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and
|
|||
|
<code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-3' class="method"><span id='divides.v-4' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#300-302' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-3' class="method"><span id='is_multiple_of.v-4' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#306-308' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-3' class="method"><span id='is_even.v-4' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#312' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.is_odd-3' class="method"><span id='is_odd.v-4' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#316' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.div_rem-3' class="method"><span id='div_rem.v-4' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</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.i32.html">i32</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#320-322' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div></div></span><h3 id='impl-Integer-4' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code><a href='#impl-Integer-4' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#515-587' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-4' class="method"><span id='div_floor.v-5' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#518-520' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer division. Returns the same result as <code>div</code> (<code>/</code>).</p>
|
|||
|
</div><h4 id='method.mod_floor-4' class="method"><span id='mod_floor.v-5' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer modulo operation. Returns the same result as <code>rem</code> (<code>%</code>).</p>
|
|||
|
</div><h4 id='method.gcd-4' class="method"><span id='gcd.v-5' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#530-550' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and <code>other</code></p>
|
|||
|
</div><h4 id='method.lcm-4' class="method"><span id='lcm.v-5' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#554-556' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and <code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-4' class="method"><span id='divides.v-5' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#560-562' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-4' class="method"><span id='is_multiple_of.v-5' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#566-568' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-4' class="method"><span id='is_even.v-5' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#572-574' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.is_odd-4' class="method"><span id='is_odd.v-5' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#578-580' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.div_rem-4' class="method"><span id='div_rem.v-5' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</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.u8.html">u8</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#584-586' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div><h4 id='method.div_mod_floor-5' class="method"><span id='div_mod_floor.v-5' class='invisible'><code>fn <a href='../num/trait.Integer.html#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#172-174' title='goto source code'>[src]</a></span></h4>
|
|||
|
</div></span><h3 id='impl-Integer-5' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a href='#impl-Integer-5' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#515-587' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-5' class="method"><span id='div_floor.v-6' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<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.u32.html">u32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#518-520' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer division. Returns the same result as <code>div</code> (<code>/</code>).</p>
|
|||
|
</div><h4 id='method.mod_floor-5' class="method"><span id='mod_floor.v-6' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<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.u32.html">u32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer modulo operation. Returns the same result as <code>rem</code> (<code>%</code>).</p>
|
|||
|
</div><h4 id='method.gcd-5' class="method"><span id='gcd.v-6' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<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.u32.html">u32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#530-550' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and <code>other</code></p>
|
|||
|
</div><h4 id='method.lcm-5' class="method"><span id='lcm.v-6' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<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.u32.html">u32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#554-556' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and <code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-5' class="method"><span id='divides.v-6' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<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.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#560-562' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-5' class="method"><span id='is_multiple_of.v-6' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<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.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#566-568' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-5' class="method"><span id='is_even.v-6' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#572-574' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.is_odd-5' class="method"><span id='is_odd.v-6' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#578-580' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.div_rem-5' class="method"><span id='div_rem.v-6' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<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.u32.html">u32</a>, <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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#584-586' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div><h4 id='method.div_mod_floor-6' class="method"><span id='div_mod_floor.v-6' class='invisible'><code>fn <a href='../num/trait.Integer.html#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#172-174' title='goto source code'>[src]</a></span></h4>
|
|||
|
</div></span><h3 id='impl-Integer-6' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code><a href='#impl-Integer-6' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#212-323' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-6' class="method"><span id='div_floor.v-7' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#215-223' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer division</p>
|
|||
|
</div><h4 id='method.mod_floor-6' class="method"><span id='mod_floor.v-7' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#227-235' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer modulo</p>
|
|||
|
</div><h4 id='method.div_mod_floor-7' class="method"><span id='div_mod_floor.v-7' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</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.i8.html">i8</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#239-247' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates <code>div_floor</code> and <code>mod_floor</code> simultaneously</p>
|
|||
|
</div><h4 id='method.gcd-6' class="method"><span id='gcd.v-7' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#252-288' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and
|
|||
|
<code>other</code>. The result is always positive.</p>
|
|||
|
</div><h4 id='method.lcm-6' class="method"><span id='lcm.v-7' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#293-296' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and
|
|||
|
<code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-6' class="method"><span id='divides.v-7' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#300-302' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-6' class="method"><span id='is_multiple_of.v-7' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#306-308' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-6' class="method"><span id='is_even.v-7' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#312' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.is_odd-6' class="method"><span id='is_odd.v-7' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#316' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.div_rem-6' class="method"><span id='div_rem.v-7' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</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.i8.html">i8</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#320-322' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div></div></span><h3 id='impl-Integer-7' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code><a href='#impl-Integer-7' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#212-323' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-7' class="method"><span id='div_floor.v-8' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#215-223' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer division</p>
|
|||
|
</div><h4 id='method.mod_floor-7' class="method"><span id='mod_floor.v-8' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#227-235' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer modulo</p>
|
|||
|
</div><h4 id='method.div_mod_floor-8' class="method"><span id='div_mod_floor.v-8' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</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.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#239-247' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates <code>div_floor</code> and <code>mod_floor</code> simultaneously</p>
|
|||
|
</div><h4 id='method.gcd-7' class="method"><span id='gcd.v-8' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#252-288' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and
|
|||
|
<code>other</code>. The result is always positive.</p>
|
|||
|
</div><h4 id='method.lcm-7' class="method"><span id='lcm.v-8' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#293-296' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and
|
|||
|
<code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-7' class="method"><span id='divides.v-8' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#300-302' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-7' class="method"><span id='is_multiple_of.v-8' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#306-308' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-7' class="method"><span id='is_even.v-8' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#312' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.is_odd-7' class="method"><span id='is_odd.v-8' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#316' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.div_rem-7' class="method"><span id='div_rem.v-8' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</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.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#320-322' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div></div></span><h3 id='impl-Integer-8' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code><a href='#impl-Integer-8' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#515-587' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-8' class="method"><span id='div_floor.v-9' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#518-520' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer division. Returns the same result as <code>div</code> (<code>/</code>).</p>
|
|||
|
</div><h4 id='method.mod_floor-8' class="method"><span id='mod_floor.v-9' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Unsigned integer modulo operation. Returns the same result as <code>rem</code> (<code>%</code>).</p>
|
|||
|
</div><h4 id='method.gcd-8' class="method"><span id='gcd.v-9' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#530-550' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and <code>other</code></p>
|
|||
|
</div><h4 id='method.lcm-8' class="method"><span id='lcm.v-9' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#554-556' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and <code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-8' class="method"><span id='divides.v-9' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#560-562' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-8' class="method"><span id='is_multiple_of.v-9' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#566-568' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-8' class="method"><span id='is_even.v-9' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#572-574' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.is_odd-8' class="method"><span id='is_odd.v-9' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#578-580' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code>.</p>
|
|||
|
</div><h4 id='method.div_rem-8' class="method"><span id='div_rem.v-9' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</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.u64.html">u64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#584-586' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div><h4 id='method.div_mod_floor-9' class="method"><span id='div_mod_floor.v-9' class='invisible'><code>fn <a href='../num/trait.Integer.html#method.div_mod_floor' class='fnname'>div_mod_floor</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self, Self<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#172-174' title='goto source code'>[src]</a></span></h4>
|
|||
|
</div></span><h3 id='impl-Integer-9' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num/trait.Integer.html" title="trait num::Integer">Integer</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><a href='#impl-Integer-9' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#212-323' title='goto source code'>[src]</a></span></h3>
|
|||
|
<span class='docblock autohide'><div class='impl-items'><h4 id='method.div_floor-9' class="method"><span id='div_floor.v-10' class='invisible'><code>fn <a href='#method.div_floor' class='fnname'>div_floor</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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#215-223' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer division</p>
|
|||
|
</div><h4 id='method.mod_floor-9' class="method"><span id='mod_floor.v-10' class='invisible'><code>fn <a href='#method.mod_floor' class='fnname'>mod_floor</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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#227-235' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Floored integer modulo</p>
|
|||
|
</div><h4 id='method.div_mod_floor-10' class="method"><span id='div_mod_floor.v-10' class='invisible'><code>fn <a href='#method.div_mod_floor' class='fnname'>div_mod_floor</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.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.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#239-247' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates <code>div_floor</code> and <code>mod_floor</code> simultaneously</p>
|
|||
|
</div><h4 id='method.gcd-9' class="method"><span id='gcd.v-10' class='invisible'><code>fn <a href='#method.gcd' class='fnname'>gcd</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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#252-288' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Greatest Common Divisor (GCD) of the number and
|
|||
|
<code>other</code>. The result is always positive.</p>
|
|||
|
</div><h4 id='method.lcm-9' class="method"><span id='lcm.v-10' class='invisible'><code>fn <a href='#method.lcm' class='fnname'>lcm</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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#293-296' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Calculates the Lowest Common Multiple (LCM) of the number and
|
|||
|
<code>other</code>.</p>
|
|||
|
</div><h4 id='method.divides-9' class="method"><span id='divides.v-10' class='invisible'><code>fn <a href='#method.divides' class='fnname'>divides</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.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#300-302' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Deprecated, use <code>is_multiple_of</code> instead.</p>
|
|||
|
</div><h4 id='method.is_multiple_of-9' class="method"><span id='is_multiple_of.v-10' class='invisible'><code>fn <a href='#method.is_multiple_of' class='fnname'>is_multiple_of</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.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#306-308' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is a multiple of <code>other</code>.</p>
|
|||
|
</div><h4 id='method.is_even-9' class="method"><span id='is_even.v-10' class='invisible'><code>fn <a href='#method.is_even' class='fnname'>is_even</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#312' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.is_odd-9' class="method"><span id='is_odd.v-10' class='invisible'><code>fn <a href='#method.is_odd' class='fnname'>is_odd</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#316' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the number is not divisible by <code>2</code></p>
|
|||
|
</div><h4 id='method.div_rem-9' class="method"><span id='div_rem.v-10' class='invisible'><code>fn <a href='#method.div_rem' class='fnname'>div_rem</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.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.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_integer/lib.rs.html#320-322' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Simultaneous truncated integer division and modulus.</p>
|
|||
|
</div></div></span>
|
|||
|
<h2 id='implementors' class='small-section-header'>
|
|||
|
Implementors<a href='#implementors' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<ul class='item-list' id='implementors-list'>
|
|||
|
<li><div class='out-of-band'><a class='srclink' href='../src/num_bigint/biguint.rs.html#919-1009' title='goto source code'>[src]</a></div><code>impl Integer for <a class="struct" href="../num/struct.BigUint.html" title="struct num::BigUint">BigUint</a></code></li>
|
|||
|
<li><div class='out-of-band'><a class='srclink' href='../src/num_bigint/bigint.rs.html#960-1050' title='goto source code'>[src]</a></div><code>impl Integer for <a class="struct" href="../num/struct.BigInt.html" title="struct num::BigInt">BigInt</a></code></li>
|
|||
|
</ul><script type="text/javascript" async
|
|||
|
src="../implementors/num_integer/trait.Integer.js">
|
|||
|
</script></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>⏎</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>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</aside>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<script>
|
|||
|
window.rootPath = "../";
|
|||
|
window.currentCrate = "num";
|
|||
|
</script>
|
|||
|
<script src="../main.js"></script>
|
|||
|
<script defer src="../search-index.js"></script>
|
|||
|
</body>
|
|||
|
</html>
|