blob: 28c041bce778fb62dcf23c4596c58c858951724c [file] [log] [blame]
<!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="A trait indicating that:"><meta name="keywords" content="rust, rustlang, rust-lang, Contiguous"><title>Contiguous in bytemuck - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../bytemuck/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../bytemuck/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Contiguous</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Int">Int</a></li></ul><h3><a href="#required-associated-consts">Required Associated Constants</a></h3><ul class="block"><li><a href="#associatedconstant.MAX_VALUE">MAX_VALUE</a></li><li><a href="#associatedconstant.MIN_VALUE">MIN_VALUE</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.from_integer">from_integer</a></li><li><a href="#method.into_integer">into_integer</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Contiguous-for-NonZeroU128">NonZeroU128</a></li><li><a href="#impl-Contiguous-for-NonZeroU16">NonZeroU16</a></li><li><a href="#impl-Contiguous-for-NonZeroU32">NonZeroU32</a></li><li><a href="#impl-Contiguous-for-NonZeroU64">NonZeroU64</a></li><li><a href="#impl-Contiguous-for-NonZeroU8">NonZeroU8</a></li><li><a href="#impl-Contiguous-for-NonZeroUsize">NonZeroUsize</a></li><li><a href="#impl-Contiguous-for-bool">bool</a></li><li><a href="#impl-Contiguous-for-i128">i128</a></li><li><a href="#impl-Contiguous-for-i16">i16</a></li><li><a href="#impl-Contiguous-for-i32">i32</a></li><li><a href="#impl-Contiguous-for-i64">i64</a></li><li><a href="#impl-Contiguous-for-i8">i8</a></li><li><a href="#impl-Contiguous-for-isize">isize</a></li><li><a href="#impl-Contiguous-for-u128">u128</a></li><li><a href="#impl-Contiguous-for-u16">u16</a></li><li><a href="#impl-Contiguous-for-u32">u32</a></li><li><a href="#impl-Contiguous-for-u64">u64</a></li><li><a href="#impl-Contiguous-for-u8">u8</a></li><li><a href="#impl-Contiguous-for-usize">usize</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In bytemuck</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="index.html">bytemuck</a>::<wbr><a class="trait" href="#">Contiguous</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bytemuck/contiguous.rs.html#78-167">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub unsafe trait Contiguous: Copy + 'static {
type <a href="#associatedtype.Int" class="associatedtype">Int</a>: Copy + Ord;
const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a>;
const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a>;
fn <a href="#method.from_integer" class="fnname">from_integer</a>(value: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a>) -&gt; Option&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.into_integer" class="fnname">into_integer</a>(self) -&gt; Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a> { ... }
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait indicating that:</p>
<ol>
<li>A type has an equivalent representation to some known integral type.</li>
<li>All instances of this type fall in a fixed range of values.</li>
<li>Within that range, there are no gaps.</li>
</ol>
<p>This is generally useful for fieldless enums (aka “c-style” enums), however
it’s important that it only be used for those with an explicit <code>#[repr]</code>, as
<code>#[repr(Rust)]</code> fieldess enums have an unspecified layout.</p>
<p>Additionally, you shouldn’t assume that all implementations are enums. Any
type which meets the requirements above while following the rules under
“Safety” below is valid.</p>
<h2 id="example"><a href="#example">Example</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq)]
</span><span class="kw">enum </span>Foo {
A = <span class="number">0</span>,
B = <span class="number">1</span>,
C = <span class="number">2</span>,
D = <span class="number">3</span>,
E = <span class="number">4</span>,
}
<span class="kw">unsafe impl </span>Contiguous <span class="kw">for </span>Foo {
<span class="kw">type </span>Int = u8;
<span class="kw">const </span>MIN_VALUE: u8 = Foo::A <span class="kw">as </span>u8;
<span class="kw">const </span>MAX_VALUE: u8 = Foo::E <span class="kw">as </span>u8;
}
<span class="macro">assert_eq!</span>(Foo::from_integer(<span class="number">3</span>).unwrap(), Foo::D);
<span class="macro">assert_eq!</span>(Foo::from_integer(<span class="number">8</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(Foo::C.into_integer(), <span class="number">2</span>);</code></pre></div>
<h2 id="safety"><a href="#safety">Safety</a></h2>
<p>This is an unsafe trait, and incorrectly implementing it is undefined
behavior.</p>
<p>Informally, by implementing it, you’re asserting that <code>C</code> is identical to
the integral type <code>C::Int</code>, and that every <code>C</code> falls between <code>C::MIN_VALUE</code>
and <code>C::MAX_VALUE</code> exactly once, without any gaps.</p>
<p>Precisely, the guarantees you must uphold when implementing <code>Contiguous</code> for
some type <code>C</code> are:</p>
<ol>
<li>
<p>The size of <code>C</code> and <code>C::Int</code> must be the same, and neither may be a ZST.
(Note: alignment is explicitly allowed to differ)</p>
</li>
<li>
<p><code>C::Int</code> must be a primitive integer, and not a wrapper type. In the
future, this may be lifted to include cases where the behavior is
identical for a relevant set of traits (Ord, arithmetic, …).</p>
</li>
<li>
<p>All <code>C::Int</code>s which are in the <em>inclusive</em> range between <code>C::MIN_VALUE</code>
and <code>C::MAX_VALUE</code> are bitwise identical to unique valid instances of
<code>C</code>.</p>
</li>
<li>
<p>There exist no instances of <code>C</code> such that their bitpatterns, when
interpreted as instances of <code>C::Int</code>, fall outside of the <code>MAX_VALUE</code> /
<code>MIN_VALUE</code> range – It is legal for unsafe code to assume that if it
gets a <code>C</code> that implements <code>Contiguous</code>, it is in the appropriate range.</p>
</li>
<li>
<p>Finally, you promise not to provide overridden implementations of
<code>Contiguous::from_integer</code> and <code>Contiguous::into_integer</code>.</p>
</li>
</ol>
<p>For clarity, the following rules could be derived from the above, but are
listed explicitly:</p>
<ul>
<li>
<p><code>C::MAX_VALUE</code> must be greater or equal to <code>C::MIN_VALUE</code> (therefore, <code>C</code>
must be an inhabited type).</p>
</li>
<li>
<p>There exist no two values between <code>MIN_VALUE</code> and <code>MAX_VALUE</code> such that
when interpreted as a <code>C</code> they are considered identical (by, say, match).</p>
</li>
</ul>
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedtype.Int" class="method has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#96">source</a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a>: Copy + Ord</h4></section></summary><div class="docblock"><p>The primitive integer type with an identical representation to this
type.</p>
<p>Contiguous is broadly intended for use with fieldless enums, and for
these the correct integer type is easy: The enum should have a
<code>#[repr(Int)]</code> or <code>#[repr(C)]</code> attribute, (if it does not, it is
<em>unsound</em> to implement <code>Contiguous</code>!).</p>
<ul>
<li>
<p>For <code>#[repr(Int)]</code>, use the listed <code>Int</code>. e.g. <code>#[repr(u8)]</code> should use
<code>type Int = u8</code>.</p>
</li>
<li>
<p>For <code>#[repr(C)]</code>, use whichever type the C compiler will use to
represent the given enum. This is usually <code>c_int</code> (from <code>std::os::raw</code>
or <code>libc</code>), but it’s up to you to make the determination as the
implementer of the unsafe trait.</p>
</li>
</ul>
<p>For precise rules, see the list under “Safety” above.</p>
</div></details></div><h2 id="required-associated-consts" class="small-section-header">Required Associated Constants<a href="#required-associated-consts" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedconstant.MAX_VALUE" class="method has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#99">source</a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a></h4></section></summary><div class="docblock"><p>The upper <em>inclusive</em> bound for valid instances of this type.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="associatedconstant.MIN_VALUE" class="method has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#102">source</a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a></h4></section></summary><div class="docblock"><p>The lower <em>inclusive</em> bound for valid instances of this type.</p>
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_integer" class="method has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#119-136">source</a><h4 class="code-header">fn <a href="#method.from_integer" class="fnname">from_integer</a>(value: Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a>) -&gt; Option&lt;Self&gt;</h4></section></summary><div class="docblock"><p>If <code>value</code> is within the range for valid instances of this type,
returns <code>Some(converted_value)</code>, otherwise, returns <code>None</code>.</p>
<p>This is a trait method so that you can write <code>value.into_integer()</code> in
your code. It is a contract of this trait that if you implement
<code>Contiguous</code> on your type you <strong>must not</strong> override this method.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>We will not panic for any correct implementation of <code>Contiguous</code>, but
<em>may</em> panic if we detect an incorrect one.</p>
<p>This is undefined behavior regardless, so it could have been the nasal
demons at that point anyway ;).</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_integer" class="method has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#154-166">source</a><h4 class="code-header">fn <a href="#method.into_integer" class="fnname">into_integer</a>(self) -&gt; Self::<a class="associatedtype" href="trait.Contiguous.html#associatedtype.Int" title="type bytemuck::Contiguous::Int">Int</a></h4></section></summary><div class="docblock"><p>Perform the conversion from <code>C</code> into the underlying integral type. This
mostly exists otherwise generic code would need unsafe for the <code>value as integer</code></p>
<p>This is a trait method so that you can write <code>value.into_integer()</code> in
your code. It is a contract of this trait that if you implement
<code>Contiguous</code> on your type you <strong>must not</strong> override this method.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>We will not panic for any correct implementation of <code>Contiguous</code>, but
<em>may</em> panic if we detect an incorrect one.</p>
<p>This is undefined behavior regardless, so it could have been the nasal
demons at that point anyway ;).</p>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-bool" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-bool" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for bool</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u8</h4></section><section id="associatedconstant.MAX_VALUE-1" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-1" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u8 = 1u8</h4></section><section id="associatedconstant.MIN_VALUE-1" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-1" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u8 = 0u8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-u8" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-u8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for u8</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u8</h4></section><section id="associatedconstant.MAX_VALUE-2" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-2" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u8 = 255u8</h4></section><section id="associatedconstant.MIN_VALUE-2" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-2" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u8 = 0u8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-u16" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-u16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for u16</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-3" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u16</h4></section><section id="associatedconstant.MAX_VALUE-3" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-3" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u16 = 65_535u16</h4></section><section id="associatedconstant.MIN_VALUE-3" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-3" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u16 = 0u16</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-u32" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-u32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for u32</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-4" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-4" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u32</h4></section><section id="associatedconstant.MAX_VALUE-4" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-4" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u32 = 4_294_967_295u32</h4></section><section id="associatedconstant.MIN_VALUE-4" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-4" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u32 = 0u32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-u64" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-u64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for u64</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-5" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-5" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u64</h4></section><section id="associatedconstant.MAX_VALUE-5" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-5" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u64 = 18_446_744_073_709_551_615u64</h4></section><section id="associatedconstant.MIN_VALUE-5" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-5" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u64 = 0u64</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-u128" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-u128" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for u128</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-6" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-6" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u128</h4></section><section id="associatedconstant.MAX_VALUE-6" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-6" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u128 = 340_282_366_920_938_463_463_374_607_431_768_211_455u128</h4></section><section id="associatedconstant.MIN_VALUE-6" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-6" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u128 = 0u128</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-usize" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-usize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for usize</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-7" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-7" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = usize</h4></section><section id="associatedconstant.MAX_VALUE-7" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-7" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: usize = 18_446_744_073_709_551_615usize</h4></section><section id="associatedconstant.MIN_VALUE-7" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-7" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: usize = 0usize</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-i8" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-i8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for i8</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-8" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-8" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = i8</h4></section><section id="associatedconstant.MAX_VALUE-8" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-8" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: i8 = 127i8</h4></section><section id="associatedconstant.MIN_VALUE-8" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-8" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: i8 = -128i8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-i16" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-i16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for i16</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-9" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-9" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = i16</h4></section><section id="associatedconstant.MAX_VALUE-9" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-9" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: i16 = 32_767i16</h4></section><section id="associatedconstant.MIN_VALUE-9" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-9" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: i16 = -32_768i16</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-i32" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-i32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for i32</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-10" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-10" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = i32</h4></section><section id="associatedconstant.MAX_VALUE-10" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-10" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: i32 = 2_147_483_647i32</h4></section><section id="associatedconstant.MIN_VALUE-10" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-10" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: i32 = -2_147_483_648i32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-i64" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-i64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for i64</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-11" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-11" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = i64</h4></section><section id="associatedconstant.MAX_VALUE-11" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-11" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: i64 = 9_223_372_036_854_775_807i64</h4></section><section id="associatedconstant.MIN_VALUE-11" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-11" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: i64 = -9_223_372_036_854_775_808i64</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-i128" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-i128" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for i128</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-12" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-12" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = i128</h4></section><section id="associatedconstant.MAX_VALUE-12" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-12" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: i128 = 170_141_183_460_469_231_731_687_303_715_884_105_727i128</h4></section><section id="associatedconstant.MIN_VALUE-12" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-12" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: i128 = -170_141_183_460_469_231_731_687_303_715_884_105_728i128</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-isize" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-isize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for isize</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-13" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-13" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = isize</h4></section><section id="associatedconstant.MAX_VALUE-13" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-13" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: isize = 9_223_372_036_854_775_807isize</h4></section><section id="associatedconstant.MIN_VALUE-13" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-13" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: isize = -9_223_372_036_854_775_808isize</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroU8" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroU8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroU8</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-14" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-14" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u8</h4></section><section id="associatedconstant.MAX_VALUE-14" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-14" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u8 = 255u8</h4></section><section id="associatedconstant.MIN_VALUE-14" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-14" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u8 = 1u8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroU16" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroU16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroU16</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-15" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-15" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u16</h4></section><section id="associatedconstant.MAX_VALUE-15" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-15" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u16 = 65_535u16</h4></section><section id="associatedconstant.MIN_VALUE-15" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-15" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u16 = 1u16</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroU32" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroU32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroU32</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-16" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-16" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u32</h4></section><section id="associatedconstant.MAX_VALUE-16" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-16" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u32 = 4_294_967_295u32</h4></section><section id="associatedconstant.MIN_VALUE-16" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-16" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u32 = 1u32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroU64" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroU64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroU64</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-17" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-17" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u64</h4></section><section id="associatedconstant.MAX_VALUE-17" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-17" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u64 = 18_446_744_073_709_551_615u64</h4></section><section id="associatedconstant.MIN_VALUE-17" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-17" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u64 = 1u64</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroU128" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroU128" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroU128</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-18" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-18" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = u128</h4></section><section id="associatedconstant.MAX_VALUE-18" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-18" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: u128 = 340_282_366_920_938_463_463_374_607_431_768_211_455u128</h4></section><section id="associatedconstant.MIN_VALUE-18" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-18" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: u128 = 1u128</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Contiguous-for-NonZeroUsize" class="impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#impl-Contiguous-for-NonZeroUsize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Contiguous.html" title="trait bytemuck::Contiguous">Contiguous</a> for NonZeroUsize</h3></section></summary><div class="impl-items"><section id="associatedtype.Int-19" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Int-19" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Int" class="associatedtype">Int</a> = usize</h4></section><section id="associatedconstant.MAX_VALUE-19" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MAX_VALUE-19" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MAX_VALUE" class="constant">MAX_VALUE</a>: usize = 18_446_744_073_709_551_615usize</h4></section><section id="associatedconstant.MIN_VALUE-19" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../src/bytemuck/contiguous.rs.html#179-202">source</a><a href="#associatedconstant.MIN_VALUE-19" class="anchor"></a><h4 class="code-header">const <a href="#associatedconstant.MIN_VALUE" class="constant">MIN_VALUE</a>: usize = 1usize</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"></div><script src="../implementors/bytemuck/contiguous/trait.Contiguous.js" data-ignore-extern-crates="core" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="bytemuck" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>