blob: 6508c4f8cbcdf1e4d0b395f5697a9f0c9105d9df [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="Abstracts over a pile of bits (basically unsigned primitives)"><meta name="keywords" content="rust, rustlang, rust-lang, BitBlock"><title>BitBlock in bit_vec - 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="../bit_vec/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="../bit_vec/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">BitBlock</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.bits">bits</a></li><li><a href="#tymethod.count_ones">count_ones</a></li><li><a href="#tymethod.from_byte">from_byte</a></li><li><a href="#tymethod.one">one</a></li><li><a href="#tymethod.zero">zero</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.bytes">bytes</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-BitBlock-for-u16">u16</a></li><li><a href="#impl-BitBlock-for-u32">u32</a></li><li><a href="#impl-BitBlock-for-u64">u64</a></li><li><a href="#impl-BitBlock-for-u8">u8</a></li><li><a href="#impl-BitBlock-for-usize">usize</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In bit_vec</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">bit_vec</a>::<wbr><a class="trait" href="#">BitBlock</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/bit_vec/lib.rs.html#118-146">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 trait BitBlock: Copy + Add&lt;Self, Output = Self&gt; + Sub&lt;Self, Output = Self&gt; + Shl&lt;usize, Output = Self&gt; + Shr&lt;usize, Output = Self&gt; + Not&lt;Output = Self&gt; + BitAnd&lt;Self, Output = Self&gt; + BitOr&lt;Self, Output = Self&gt; + BitXor&lt;Self, Output = Self&gt; + Rem&lt;Self, Output = Self&gt; + Eq + Ord + Hash {
fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize;
<span class="item-spacer"></span> fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize;
<span class="item-spacer"></span> fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self;
fn <a href="#method.bytes" class="fnname">bytes</a>() -&gt; usize { ... }
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Abstracts over a pile of bits (basically unsigned primitives)</p>
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.bits" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#134">source</a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section></summary><div class="docblock"><p>How many bits it has</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.from_byte" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#139">source</a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert a byte into this type (lowest-order bits set)</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.count_ones" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#141">source</a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section></summary><div class="docblock"><p>Count the number of 1’s in the bitwise repr</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.zero" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#143">source</a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Get <code>0</code></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.one" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#145">source</a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Get <code>1</code></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.bytes" class="method has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#137">source</a><h4 class="code-header">fn <a href="#method.bytes" class="fnname">bytes</a>() -&gt; usize</h4></section></summary><div class="docblock"><p>How many bytes it has</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-BitBlock-for-u8" class="impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#impl-BitBlock-for-u8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a> for u8</h3></section></summary><div class="impl-items"><section id="method.bits" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.bits" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section><section id="method.from_byte" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.from_byte" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section><section id="method.count_ones" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.count_ones" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section><section id="method.one" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.one" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section><section id="method.zero" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.zero" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BitBlock-for-u16" class="impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#impl-BitBlock-for-u16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a> for u16</h3></section></summary><div class="impl-items"><section id="method.bits-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.bits-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section><section id="method.from_byte-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.from_byte-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section><section id="method.count_ones-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.count_ones-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section><section id="method.one-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.one-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section><section id="method.zero-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.zero-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BitBlock-for-u32" class="impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#impl-BitBlock-for-u32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a> for u32</h3></section></summary><div class="impl-items"><section id="method.bits-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.bits-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section><section id="method.from_byte-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.from_byte-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section><section id="method.count_ones-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.count_ones-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section><section id="method.one-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.one-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section><section id="method.zero-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.zero-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BitBlock-for-u64" class="impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#impl-BitBlock-for-u64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a> for u64</h3></section></summary><div class="impl-items"><section id="method.bits-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.bits-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section><section id="method.from_byte-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.from_byte-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section><section id="method.count_ones-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.count_ones-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section><section id="method.one-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.one-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section><section id="method.zero-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.zero-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BitBlock-for-usize" class="impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#impl-BitBlock-for-usize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a> for usize</h3></section></summary><div class="impl-items"><section id="method.bits-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.bits-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.bits" class="fnname">bits</a>() -&gt; usize</h4></section><section id="method.from_byte-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.from_byte-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_byte" class="fnname">from_byte</a>(byte: u8) -&gt; Self</h4></section><section id="method.count_ones-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.count_ones-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.count_ones" class="fnname">count_ones</a>(self) -&gt; usize</h4></section><section id="method.one-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.one-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.one" class="fnname">one</a>() -&gt; Self</h4></section><section id="method.zero-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bit_vec/lib.rs.html#165-171">source</a><a href="#method.zero-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.zero" class="fnname">zero</a>() -&gt; Self</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/bit_vec/trait.BitBlock.js" data-ignore-extern-crates="core" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="bit_vec" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>