|
|
<!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 `f16` struct in crate `half`."><meta name="keywords" content="rust, rustlang, rust-lang, f16"><title>half::f16 - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../half/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct f16</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.as_bits">as_bits</a><a href="#method.classify">classify</a><a href="#method.from_bits">from_bits</a><a href="#method.from_f32">from_f32</a><a href="#method.from_f64">from_f64</a><a href="#method.is_finite">is_finite</a><a href="#method.is_infinite">is_infinite</a><a href="#method.is_nan">is_nan</a><a href="#method.is_normal">is_normal</a><a href="#method.is_sign_negative">is_sign_negative</a><a href="#method.is_sign_positive">is_sign_positive</a><a href="#method.signum">signum</a><a href="#method.to_bits">to_bits</a><a href="#method.to_f32">to_f32</a><a href="#method.to_f64">to_f64</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-Display">Display</a><a href="#impl-From%3Cf16%3E">From<f16></a><a href="#impl-From%3Ci8%3E">From<i8></a><a href="#impl-From%3Cu8%3E">From<u8></a><a href="#impl-FromStr">FromStr</a><a href="#impl-LowerExp">LowerExp</a><a href="#impl-PartialEq%3Cf16%3E">PartialEq<f16></a><a href="#impl-PartialOrd%3Cf16%3E">PartialOrd<f16></a><a href="#impl-UpperExp">UpperExp</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class='location'><a href='index.html'>half</a></p><script>window.sidebarCurrent = {name: 'f16', ty: 'struct', 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"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='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/half/lib.rs.html#48' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>half</a>::<wbr><a class="struct" href=''>f16</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct f16(_);</pre></div><div class='docblock'><p>The 16-bit floating point type.</p>
|
|
|
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#130-392' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from_bits' class="method"><code id='from_bits.v'>pub fn <a href='#method.from_bits' class='fnname'>from_bits</a>(bits: u16) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#133-135' title='goto source code'>[src]</a></h4><div class='docblock'><p>Constructs a 16-bit floating point value from the raw bits.</p>
|
|
|
</div><h4 id='method.from_f32' class="method"><code id='from_f32.v'>pub fn <a href='#method.from_f32' class='fnname'>from_f32</a>(value: f32) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#145-147' title='goto source code'>[src]</a></h4><div class='docblock'><p>Constructs a 16-bit floating point value from a 32-bit floating point value.</p>
|
|
|
<p>If the 32-bit value is to large to fit in 16-bits, +/- infinity will result. NaN values are
|
|
|
preserved. 32-bit subnormal values are too tiny to be represented in 16-bits and result in
|
|
|
+/- 0. Exponents that underflow the minimum 16-bit exponent will result in 16-bit subnormals
|
|
|
or +/- 0. All other values are truncated and rounded to the nearest representable 16-bit
|
|
|
value.</p>
|
|
|
</div><h4 id='method.from_f64' class="method"><code id='from_f64.v'>pub fn <a href='#method.from_f64' class='fnname'>from_f64</a>(value: f64) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#157-159' title='goto source code'>[src]</a></h4><div class='docblock'><p>Constructs a 16-bit floating point value from a 64-bit floating point value.</p>
|
|
|
<p>If the 64-bit value is to large to fit in 16-bits, +/- infinity will result. NaN values are
|
|
|
preserved. 64-bit subnormal values are too tiny to be represented in 16-bits and result in
|
|
|
+/- 0. Exponents that underflow the minimum 16-bit exponent will result in 16-bit subnormals
|
|
|
or +/- 0. All other values are truncated and rounded to the nearest representable 16-bit
|
|
|
value.</p>
|
|
|
</div><h4 id='method.to_bits' class="method"><code id='to_bits.v'>pub fn <a href='#method.to_bits' class='fnname'>to_bits</a>(self) -> u16</code><a class='srclink' href='../src/half/lib.rs.html#163-165' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>f16</code> into the underlying bit representation.</p>
|
|
|
</div><h4 id='method.as_bits' class="method"><code id='as_bits.v'>pub fn <a href='#method.as_bits' class='fnname'>as_bits</a>(self) -> u16</code><a class='srclink' href='../src/half/lib.rs.html#170-172' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab deprecated'>Deprecated since 1.2.0: <p>renamed to to_bits</p>
|
|
|
</div></div><div class='docblock'><p>Converts an <code>f16</code> into the underlying bit representation.</p>
|
|
|
</div><h4 id='method.to_f32' class="method"><code id='to_f32.v'>pub fn <a href='#method.to_f32' class='fnname'>to_f32</a>(self) -> f32</code><a class='srclink' href='../src/half/lib.rs.html#179-181' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>f16</code> value in a <code>f32</code> value.</p>
|
|
|
<p>This conversion is lossless as all 16-bit floating point values can be represented exactly
|
|
|
in 32-bit floating point.</p>
|
|
|
</div><h4 id='method.to_f64' class="method"><code id='to_f64.v'>pub fn <a href='#method.to_f64' class='fnname'>to_f64</a>(self) -> f64</code><a class='srclink' href='../src/half/lib.rs.html#188-190' title='goto source code'>[src]</a></h4><div class='docblock'><p>Converts an <code>f16</code> value in a <code>f64</code> value.</p>
|
|
|
<p>This conversion is lossless as all 16-bit floating point values can be represented exactly
|
|
|
in 64-bit floating point.</p>
|
|
|
</div><h4 id='method.is_nan' class="method"><code id='is_nan.v'>pub fn <a href='#method.is_nan' class='fnname'>is_nan</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#206-208' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if this value is <code>NaN</code> and <code>false</code> otherwise.</p>
|
|
|
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">nan</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>;
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">7.0_f32</span>);
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">nan</span>.<span class="ident">is_nan</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">f</span>.<span class="ident">is_nan</span>());</pre></div>
|
|
|
</div><h4 id='method.is_infinite' class="method"><code id='is_infinite.v'>pub fn <a href='#method.is_infinite' class='fnname'>is_infinite</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#230-232' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if this value is positive infinity or negative infinity and <code>false</code>
|
|
|
otherwise.</p>
|
|
|
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">7.0f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">inf</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">INFINITY</span>;
|
|
|
<span class="kw">let</span> <span class="ident">neg_inf</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NEG_INFINITY</span>;
|
|
|
<span class="kw">let</span> <span class="ident">nan</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>;
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">f</span>.<span class="ident">is_infinite</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">nan</span>.<span class="ident">is_infinite</span>());
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">inf</span>.<span class="ident">is_infinite</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">neg_inf</span>.<span class="ident">is_infinite</span>());</pre></div>
|
|
|
</div><h4 id='method.is_finite' class="method"><code id='is_finite.v'>pub fn <a href='#method.is_finite' class='fnname'>is_finite</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#253-255' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if this number is neither infinite nor <code>NaN</code>.</p>
|
|
|
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">7.0f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">inf</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">INFINITY</span>;
|
|
|
<span class="kw">let</span> <span class="ident">neg_inf</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NEG_INFINITY</span>;
|
|
|
<span class="kw">let</span> <span class="ident">nan</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>;
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">f</span>.<span class="ident">is_finite</span>());
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">nan</span>.<span class="ident">is_finite</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">inf</span>.<span class="ident">is_finite</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">neg_inf</span>.<span class="ident">is_finite</span>());</pre></div>
|
|
|
</div><h4 id='method.is_normal' class="method"><code id='is_normal.v'>pub fn <a href='#method.is_normal' class='fnname'>is_normal</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#279-282' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if the number is neither zero, infinite, subnormal, or <code>NaN</code>.</p>
|
|
|
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">min</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">MIN_POSITIVE</span>;
|
|
|
<span class="kw">let</span> <span class="ident">max</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">MAX</span>;
|
|
|
<span class="kw">let</span> <span class="ident">lower_than_min</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">1.0e-10_f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">zero</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">0.0_f32</span>);
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">min</span>.<span class="ident">is_normal</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">max</span>.<span class="ident">is_normal</span>());
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">zero</span>.<span class="ident">is_normal</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>.<span class="ident">is_normal</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">INFINITY</span>.<span class="ident">is_normal</span>());
|
|
|
<span class="comment">// Values between `0` and `min` are Subnormal.</span>
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">lower_than_min</span>.<span class="ident">is_normal</span>());</pre></div>
|
|
|
</div><h4 id='method.classify' class="method"><code id='classify.v'>pub fn <a href='#method.classify' class='fnname'>classify</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/num/enum.FpCategory.html" title="enum core::num::FpCategory">FpCategory</a></code><a class='srclink' href='../src/half/lib.rs.html#301-319' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the floating point category of the number.</p>
|
|
|
<p>If only one property is going to be tested, it is generally faster to use the specific
|
|
|
predicate instead.</p>
|
|
|
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">num</span>::<span class="ident">FpCategory</span>;
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">num</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">12.4_f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">inf</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">INFINITY</span>;
|
|
|
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">num</span>.<span class="ident">classify</span>(), <span class="ident">FpCategory</span>::<span class="ident">Normal</span>);
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">inf</span>.<span class="ident">classify</span>(), <span class="ident">FpCategory</span>::<span class="ident">Infinite</span>);</pre></div>
|
|
|
</div><h4 id='method.signum' class="method"><code id='signum.v'>pub fn <a href='#method.signum' class='fnname'>signum</a>(self) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#339-347' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns a number that represents the sign of <code>self</code>.</p>
|
|
|
<ul>
|
|
|
<li><code>1.0</code> if the number is positive, <code>+0.0</code> or <code>INFINITY</code></li>
|
|
|
<li><code>-1.0</code> if the number is negative, <code>-0.0</code> or <code>NEG_INFINITY</code></li>
|
|
|
<li><code>NAN</code> if the number is <code>NAN</code></li>
|
|
|
</ul>
|
|
|
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">3.5_f32</span>);
|
|
|
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">f</span>.<span class="ident">signum</span>(), <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">1.0</span>));
|
|
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NEG_INFINITY</span>.<span class="ident">signum</span>(), <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="op">-</span><span class="number">1.0</span>));
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>.<span class="ident">signum</span>().<span class="ident">is_nan</span>());</pre></div>
|
|
|
</div><h4 id='method.is_sign_positive' class="method"><code id='is_sign_positive.v'>pub fn <a href='#method.is_sign_positive' class='fnname'>is_sign_positive</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#367-369' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if and only if <code>self</code> has a positive sign, including <code>+0.0</code>, <code>NaNs</code> with
|
|
|
positive sign bit and positive infinity.</p>
|
|
|
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">nan</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>;
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">7.0_f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">g</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="op">-</span><span class="number">7.0_f32</span>);
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">f</span>.<span class="ident">is_sign_positive</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">g</span>.<span class="ident">is_sign_positive</span>());
|
|
|
<span class="comment">// `NaN` can be either positive or negative</span>
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">nan</span>.<span class="ident">is_sign_positive</span>() <span class="op">!</span><span class="op">=</span> <span class="ident">nan</span>.<span class="ident">is_sign_negative</span>());</pre></div>
|
|
|
</div><h4 id='method.is_sign_negative' class="method"><code id='is_sign_negative.v'>pub fn <a href='#method.is_sign_negative' class='fnname'>is_sign_negative</a>(self) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#389-391' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns <code>true</code> if and only if <code>self</code> has a negative sign, including <code>-0.0</code>, <code>NaNs</code> with
|
|
|
negative sign bit and negative infinity.</p>
|
|
|
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
|
|
<span class="kw">use</span> <span class="ident">half</span>::<span class="ident">f16</span>;
|
|
|
|
|
|
<span class="kw">let</span> <span class="ident">nan</span> <span class="op">=</span> <span class="ident">half</span>::<span class="ident">consts</span>::<span class="ident">NAN</span>;
|
|
|
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="number">7.0f32</span>);
|
|
|
<span class="kw">let</span> <span class="ident">g</span> <span class="op">=</span> <span class="ident">f16</span>::<span class="ident">from_f32</span>(<span class="op">-</span><span class="number">7.0f32</span>);
|
|
|
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">f</span>.<span class="ident">is_sign_negative</span>());
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">g</span>.<span class="ident">is_sign_negative</span>());
|
|
|
<span class="comment">// `NaN` can be either positive or negative</span>
|
|
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">nan</span>.<span class="ident">is_sign_positive</span>() <span class="op">!</span><span class="op">=</span> <span class="ident">nan</span>.<span class="ident">is_sign_negative</span>());</pre></div>
|
|
|
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-From%3Cf16%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>> for f32</code><a href='#impl-From%3Cf16%3E' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#394-398' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(x: <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> f32</code><a class='srclink' href='../src/half/lib.rs.html#395-397' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-From%3Cf16%3E-1' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>> for f64</code><a href='#impl-From%3Cf16%3E-1' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#400-404' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-1' class="method hidden"><code id='from.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(x: <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> f64</code><a class='srclink' href='../src/half/lib.rs.html#401-403' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-From%3Ci8%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><i8> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-From%3Ci8%3E' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#406-411' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-2' class="method hidden"><code id='from.v-2'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(x: i8) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#407-410' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-From%3Cu8%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><u8> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-From%3Cu8%3E' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#413-418' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-3' class="method hidden"><code id='from.v-3'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(x: u8) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#414-417' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-PartialEq%3Cf16%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-PartialEq%3Cf16%3E' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#420-428' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.eq' class="method hidden"><code id='eq.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#421-427' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
|
|
</div><h4 id='method.ne' class="method hidden"><code id='ne.v'><span class="docblock attributes">#[must_use]
|
|
|
</span>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: &Rhs) -> bool</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#208' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
|
|
|
</div></div><h3 id='impl-PartialOrd%3Cf16%3E' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-PartialOrd%3Cf16%3E' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#430-517' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.partial_cmp' class="method hidden"><code id='partial_cmp.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code><a class='srclink' href='../src/half/lib.rs.html#431-456' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|
|
</div><h4 id='method.lt' class="method hidden"><code id='lt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#458-471' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|
|
</div><h4 id='method.le' class="method hidden"><code id='le.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#473-486' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|
|
</div><h4 id='method.gt' class="method hidden"><code id='gt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#488-501' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|
|
</div><h4 id='method.ge' class="method hidden"><code id='ge.v'>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: &<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>) -> bool</code><a class='srclink' href='../src/half/lib.rs.html#503-516' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|
|
</div></div><h3 id='impl-UpperExp' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperExp.html" title="trait core::fmt::UpperExp">UpperExp</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-UpperExp' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#544-548' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.UpperExp.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code><a class='srclink' href='../src/half/lib.rs.html#545-547' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter.</p>
|
|
|
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#526-530' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-1' class="method hidden"><code id='fmt.v-1'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code><a class='srclink' href='../src/half/lib.rs.html#527-529' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
|
|
</div></div><h3 id='impl-LowerExp' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerExp.html" title="trait core::fmt::LowerExp">LowerExp</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-LowerExp' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#538-542' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-2' class="method hidden"><code id='fmt.v-2'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.LowerExp.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code><a class='srclink' href='../src/half/lib.rs.html#539-541' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter.</p>
|
|
|
</div></div><h3 id='impl-Display' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Display' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#532-536' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt-3' class="method hidden"><code id='fmt.v-3'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><(), <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code><a class='srclink' href='../src/half/lib.rs.html#533-535' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
|
|
</div></div><h3 id='impl-FromStr' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html" title="trait core::str::FromStr">FromStr</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-FromStr' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#519-524' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Err' class="type"><code id='Err.t'>type <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#associatedtype.Err' class="type">Err</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/dec2flt/struct.ParseFloatError.html" title="struct core::num::dec2flt::ParseFloatError">ParseFloatError</a></code></h4><div class='docblock'><p>The associated error which can be returned from parsing.</p>
|
|
|
</div><h4 id='method.from_str' class="method hidden"><code id='from_str.v'>fn <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#tymethod.from_str' class='fnname'>from_str</a>(src: &str) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/dec2flt/struct.ParseFloatError.html" title="struct core::num::dec2flt::ParseFloatError">ParseFloatError</a>></code><a class='srclink' href='../src/half/lib.rs.html#521-523' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#tymethod.from_str">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Copy' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Copy' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#46' title='goto source code'>[src]</a></h3><div class='impl-items'></div><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#46' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#46' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
|
|
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Default' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Default' class='anchor'></a><a class='srclink' href='../src/half/lib.rs.html#46' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.default' class="method hidden"><code id='default.v'>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -> <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a class='srclink' href='../src/half/lib.rs.html#46' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns the "default value" for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
|
|
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../half/struct.f16.html" title="struct half::f16">f16</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553-555' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from-4' class="method hidden"><code id='from.v-4'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#554' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#572-578' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
|
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#575-577' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#544-549' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#560-567' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
|
|
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#564-566' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
|
|
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> &T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
|
|
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> &mut T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
|
|
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
|
|
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "half";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |