mirror of
https://github.com/Rust-GPU/rust-gpu.git
synced 2026-06-07 18:19:50 +09:00
605 lines
146 KiB
HTML
605 lines
146 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The bitvector type."><title>BitVec in bit_vec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-17e0aaed.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bit_vec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.96.0-nightly (02c7f9bec 2026-04-10)" data-channel="nightly" data-search-js="search-b5634cc7.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../static.files/storage-41dd4d93.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5013f961.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">BitVec</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bit_vec/index.html">bit_vec</a><span class="version">0.9.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">BitVec</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#implementations">Associated Functions</a></h3><ul class="block method"><li><a href="#method.new" title="new">new</a></li><li><a href="#method.from_elem" title="from_elem">from_elem</a></li><li><a href="#method.with_capacity" title="with_capacity">with_capacity</a></li><li><a href="#method.from_bytes" title="from_bytes">from_bytes</a></li><li><a href="#method.from_fn" title="from_fn">from_fn</a></li><li><a href="#method.new_general" title="new_general">new_general</a></li><li><a href="#method.from_elem_general" title="from_elem_general">from_elem_general</a></li><li><a href="#method.with_capacity_general" title="with_capacity_general">with_capacity_general</a></li><li><a href="#method.from_bytes_general" title="from_bytes_general">from_bytes_general</a></li><li><a href="#method.from_fn_general" title="from_fn_general">from_fn_general</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.all" title="all">all</a></li><li><a href="#method.and" title="and">and</a></li><li><a href="#method.any" title="any">any</a></li><li><a href="#method.append" title="append">append</a></li><li><a href="#method.blocks" title="blocks">blocks</a></li><li><a href="#method.capacity" title="capacity">capacity</a></li><li><a href="#method.clear" title="clear">clear</a></li><li><a href="#method.count_ones" title="count_ones">count_ones</a></li><li><a href="#method.count_zeros" title="count_zeros">count_zeros</a></li><li><a href="#method.difference" title="difference">difference</a></li><li><a href="#method.eq_vec" title="eq_vec">eq_vec</a></li><li><a href="#method.fill" title="fill">fill</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_mut" title="get_mut">get_mut</a></li><li><a href="#method.get_unchecked" title="get_unchecked">get_unchecked</a></li><li><a href="#method.get_unchecked_mut" title="get_unchecked_mut">get_unchecked_mut</a></li><li><a href="#method.grow" title="grow">grow</a></li><li><a href="#method.insert" title="insert">insert</a></li><li><a href="#method.intersect" title="intersect">intersect</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.iter" title="iter">iter</a></li><li><a href="#method.iter_mut" title="iter_mut">iter_mut</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.nand" title="nand">nand</a></li><li><a href="#method.negate" title="negate">negate</a></li><li><a href="#method.none" title="none">none</a></li><li><a href="#method.nor" title="nor">nor</a></li><li><a href="#method.or" title="or">or</a></li><li><a href="#method.pop" title="pop">pop</a></li><li><a href="#method.push" title="push">push</a></li><li><a href="#method.push_within_capacity" title="push_within_capacity">push_within_capacity</a></li><li><a href="#method.remove" title="remove">remove</a></li><li><a href="#method.remove_all" title="remove_all">remove_all</a></li><li><a href="#method.reserve" title="reserve">reserve</a></li><li><a href="#method.reserve_exact" title="reserve_exact">reserve_exact</a></li><li><a href="#method.set" title="set">set</a></li><li><a href="#method.set_all" title="set_all">set_all</a></li><li><a href="#method.set_len" title="set_len">set_len</a></li><li><a href="#method.shrink_to_fit" title="shrink_to_fit">shrink_to_fit</a></li><li><a href="#method.split_off" title="split_off">split_off</a></li><li><a href="#method.storage" title="storage">storage</a></li><li><a href="#method.storage_mut" title="storage_mut">storage_mut</a></li><li><a href="#method.to_bytes" title="to_bytes">to_bytes</a></li><li><a href="#method.truncate" title="truncate">truncate</a></li><li><a href="#method.union" title="union">union</a></li><li><a href="#method.xnor" title="xnor">xnor</a></li><li><a href="#method.xor" title="xor">xor</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-BitVec%3CB%3E" title="Clone">Clone</a></li><li><a href="#impl-Debug-for-BitVec%3CB%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-BitVec%3CB%3E" title="Default">Default</a></li><li><a href="#impl-Display-for-BitVec%3CB%3E" title="Display">Display</a></li><li><a href="#impl-Eq-for-BitVec%3CB%3E" title="Eq">Eq</a></li><li><a href="#impl-Extend%3Cbool%3E-for-BitVec%3CB%3E" title="Extend<bool>">Extend<bool></a></li><li><a href="#impl-FromIterator%3Cbool%3E-for-BitVec%3CB%3E" title="FromIterator<bool>">FromIterator<bool></a></li><li><a href="#impl-Hash-for-BitVec%3CB%3E" title="Hash">Hash</a></li><li><a href="#impl-Index%3Cusize%3E-for-BitVec%3CB%3E" title="Index<usize>">Index<usize></a></li><li><a href="#impl-IntoIterator-for-%26BitVec%3CB%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-IntoIterator-for-BitVec%3CB%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-Ord-for-BitVec%3CB%3E" title="Ord">Ord</a></li><li><a href="#impl-PartialEq-for-BitVec%3CB%3E" title="PartialEq">PartialEq</a></li><li><a href="#impl-PartialOrd-for-BitVec%3CB%3E" title="PartialOrd">PartialOrd</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-BitVec%3CB%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-BitVec%3CB%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BitVec%3CB%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-BitVec%3CB%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-BitVec%3CB%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnsafeUnpin-for-BitVec%3CB%3E" title="UnsafeUnpin">UnsafeUnpin</a></li><li><a href="#impl-UnwindSafe-for-BitVec%3CB%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-ToString-for-T" title="ToString">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bit_<wbr>vec</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">bit_vec</a></div><h1>Struct <span class="struct">BitVec</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/bit_vec/lib.rs.html#260-265">Source</a> </span></div><pre class="rust item-decl"><code>pub struct BitVec<B = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>> { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The bitvector type.</p>
|
||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">10</span>, <span class="bool-val">false</span>);
|
||
|
||
<span class="comment">// insert all primes less than 10
|
||
</span>bv.set(<span class="number">2</span>, <span class="bool-val">true</span>);
|
||
bv.set(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
bv.set(<span class="number">5</span>, <span class="bool-val">true</span>);
|
||
bv.set(<span class="number">7</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, bv);
|
||
<span class="macro">println!</span>(<span class="string">"total bits set to true: {}"</span>, bv.iter().filter(|x| <span class="kw-2">*</span>x).count());
|
||
|
||
<span class="comment">// flip all values in bitvector, producing non-primes less than 10
|
||
</span>bv.negate();
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, bv);
|
||
<span class="macro">println!</span>(<span class="string">"total bits set to true: {}"</span>, bv.iter().filter(|x| <span class="kw-2">*</span>x).count());
|
||
|
||
<span class="comment">// reset bitvector to empty
|
||
</span>bv.fill(<span class="bool-val">false</span>);
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, bv);
|
||
<span class="macro">println!</span>(<span class="string">"total bits set to true: {}"</span>, bv.iter().filter(|x| <span class="kw-2">*</span>x).count());</code></pre></div></div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-BitVec" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#304-386">Source</a><a href="#impl-BitVec" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#314-316">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>BitVec</code>.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::new();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_elem" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#333-335">Source</a><h4 class="code-header">pub fn <a href="#method.from_elem" class="fn">from_elem</a>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, bit: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a <code>BitVec</code> that holds <code>nbits</code> elements, setting each element
|
||
to <code>bit</code>.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">10</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">10</span>);
|
||
<span class="kw">for </span>x <span class="kw">in </span>bv.iter() {
|
||
<span class="macro">assert_eq!</span>(x, <span class="bool-val">false</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.with_capacity" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#345-347">Source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fn">with_capacity</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Constructs a new, empty <code>BitVec</code> with the specified capacity.</p>
|
||
<p>The bitvector will be able to hold at least <code>capacity</code> bits without
|
||
reallocating. If <code>capacity</code> is 0, it will not allocate.</p>
|
||
<p>It is important to note that this function does not specify the
|
||
<em>length</em> of the returned bitvector, but only the <em>capacity</em>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_bytes" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#364-366">Source</a><h4 class="code-header">pub fn <a href="#method.from_bytes" class="fn">from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>]) -> Self</h4></section></summary><div class="docblock"><p>Transforms a byte-vector into a <code>BitVec</code>. Each byte becomes eight bits,
|
||
with the most significant bits of each byte coming first. Each
|
||
bit becomes <code>true</code> if equal to 1 or <code>false</code> if equal to 0.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b10100000</span>, <span class="number">0b00010010</span>]);
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_fn" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#380-385">Source</a><h4 class="code-header">pub fn <a href="#method.from_fn" class="fn">from_fn</a><F>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, f: F) -> Self<div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Creates a <code>BitVec</code> of the specified length where the value at each index
|
||
is <code>f(index)</code>.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_fn(<span class="number">5</span>, |i| { i % <span class="number">2 </span>== <span class="number">0 </span>});
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#388-1930">Source</a><a href="#impl-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new_general" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#398-400">Source</a><h4 class="code-header">pub fn <a href="#method.new_general" class="fn">new_general</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates an empty <code>BitVec</code>.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::<usize>::new_general();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_elem_general" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#417-425">Source</a><h4 class="code-header">pub fn <a href="#method.from_elem_general" class="fn">from_elem_general</a>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, bit: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a <code>BitVec</code> that holds <code>nbits</code> elements, setting each element
|
||
to <code>bit</code>.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::<usize>::from_elem_general(<span class="number">10</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">10</span>);
|
||
<span class="kw">for </span>x <span class="kw">in </span>bv.iter() {
|
||
<span class="macro">assert_eq!</span>(x, <span class="bool-val">false</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.with_capacity_general" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#435-440">Source</a><h4 class="code-header">pub fn <a href="#method.with_capacity_general" class="fn">with_capacity_general</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Constructs a new, empty <code>BitVec</code> with the specified capacity.</p>
|
||
<p>The bitvector will be able to hold at least <code>capacity</code> bits without
|
||
reallocating. If <code>capacity</code> is 0, it will not allocate.</p>
|
||
<p>It is important to note that this function does not specify the
|
||
<em>length</em> of the returned bitvector, but only the <em>capacity</em>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_bytes_general" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#457-485">Source</a><h4 class="code-header">pub fn <a href="#method.from_bytes_general" class="fn">from_bytes_general</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>]) -> Self</h4></section></summary><div class="docblock"><p>Transforms a byte-vector into a <code>BitVec</code>. Each byte becomes eight bits,
|
||
with the most significant bits of each byte coming first. Each
|
||
bit becomes <code>true</code> if equal to 1 or <code>false</code> if equal to 0.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::<usize>::from_bytes_general(<span class="kw-2">&</span>[<span class="number">0b10100000</span>, <span class="number">0b00010010</span>]);
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_fn_general" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#499-508">Source</a><h4 class="code-header">pub fn <a href="#method.from_fn_general" class="fn">from_fn_general</a><F>(len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, f: F) -> Self<div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Creates a <code>BitVec</code> of the specified length where the value at each index
|
||
is <code>f(index)</code>.</p>
|
||
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::<usize>::from_fn_general(<span class="number">5</span>, |i| { i % <span class="number">2 </span>== <span class="number">0 </span>});
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.blocks" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#538-543">Source</a><h4 class="code-header">pub fn <a href="#method.blocks" class="fn">blocks</a>(&self) -> <a class="struct" href="struct.Blocks.html" title="struct bit_vec::Blocks">Blocks</a><'_, B> <a href="#" class="tooltip" data-notable-ty="Blocks<'_, B>">ⓘ</a></h4></section></summary><div class="docblock"><p>Iterator over the underlying blocks of data</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.storage" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#549-551">Source</a><h4 class="code-header">pub fn <a href="#method.storage" class="fn">storage</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">[B]</a></h4></section></summary><div class="docblock"><p>Exposes the raw block storage of this <code>BitVec</code>.</p>
|
||
<p>Only really intended for <code>BitSet</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.storage_mut" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#559-561">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.storage_mut" class="fn">storage_mut</a>(&mut self) -> &mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><B></h4></section></summary><div class="docblock"><p>Exposes the raw block storage of this <code>BitVec</code>.</p>
|
||
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
|
||
<p>Can probably cause unsafety. Only really intended for <code>BitSet</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#644-654">Source</a><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a>(&self, i: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>></h4></section></summary><div class="docblock"><p>Retrieves the value at index <code>i</code>, or <code>None</code> if the index is out of bounds.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01100000</span>]);
|
||
<span class="macro">assert_eq!</span>(bv.get(<span class="number">0</span>), <span class="prelude-val">Some</span>(<span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq!</span>(bv.get(<span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="bool-val">true</span>));
|
||
<span class="macro">assert_eq!</span>(bv.get(<span class="number">100</span>), <span class="prelude-val">None</span>);
|
||
|
||
<span class="comment">// Can also use array indexing
|
||
</span><span class="macro">assert_eq!</span>(bv[<span class="number">1</span>], <span class="bool-val">true</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#677-683">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fn">get_unchecked</a>(&self, i: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Retrieves the value at index <code>i</code>, without doing bounds checking.</p>
|
||
<p>For a safe alternative, see <code>get</code>.</p>
|
||
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
|
||
<p>Calling this method with an out-of-bounds index is undefined behavior
|
||
even if the resulting reference is not used.</p>
|
||
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01100000</span>]);
|
||
<span class="kw">unsafe </span>{
|
||
<span class="macro">assert_eq!</span>(bv.get_unchecked(<span class="number">0</span>), <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.get_unchecked(<span class="number">1</span>), <span class="bool-val">true</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#699-707">Source</a><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</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="struct" href="struct.MutBorrowedBit.html" title="struct bit_vec::MutBorrowedBit">MutBorrowedBit</a><'_, B>></h4></section></summary><div class="docblock"><p>Retrieves a smart pointer to the value at index <code>i</code>, or <code>None</code> if the index is out of bounds.</p>
|
||
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01100000</span>]);
|
||
<span class="kw-2">*</span>bv.get_mut(<span class="number">0</span>).unwrap() = <span class="bool-val">true</span>;
|
||
<span class="kw-2">*</span>bv.get_mut(<span class="number">1</span>).unwrap() = <span class="bool-val">false</span>;
|
||
<span class="macro">assert!</span>(bv.get_mut(<span class="number">100</span>).is_none());
|
||
<span class="macro">assert_eq!</span>(bv, BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b10100000</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked_mut" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#729-738">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked_mut" class="fn">get_unchecked_mut</a>(
|
||
&mut self,
|
||
index: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>,
|
||
) -> <a class="struct" href="struct.MutBorrowedBit.html" title="struct bit_vec::MutBorrowedBit">MutBorrowedBit</a><'_, B></h4></section></summary><div class="docblock"><p>Retrieves a smart pointer to the value at index <code>i</code>, without doing bounds checking.</p>
|
||
<h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5>
|
||
<p>Calling this method with out-of-bounds <code>index</code> may cause undefined behavior even when
|
||
the result is not used.</p>
|
||
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01100000</span>]);
|
||
<span class="kw">unsafe </span>{
|
||
<span class="kw-2">*</span>bv.get_unchecked_mut(<span class="number">0</span>) = <span class="bool-val">true</span>;
|
||
<span class="kw-2">*</span>bv.get_unchecked_mut(<span class="number">1</span>) = <span class="bool-val">false</span>;
|
||
}
|
||
<span class="macro">assert_eq!</span>(bv, BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b10100000</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.set" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#756-773">Source</a><h4 class="code-header">pub fn <a href="#method.set" class="fn">set</a>(&mut self, i: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Sets the value of a bit at an index <code>i</code>.</p>
|
||
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
|
||
<p>Panics if <code>i</code> is out of bounds.</p>
|
||
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">5</span>, <span class="bool-val">false</span>);
|
||
bv.set(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv[<span class="number">3</span>], <span class="bool-val">true</span>);</code></pre></div></div></details><details class="toggle method-toggle deprecated" open><summary><section id="method.set_all" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#791-797">Source</a><h4 class="code-header">pub fn <a href="#method.set_all" class="fn">set_all</a>(&mut self)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.9.0: <p>please use <code>.fill(true)</code> instead</p>
|
||
</span></div></span></summary><div class="docblock"><p>Sets all bits to 1.</p>
|
||
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>before = <span class="number">0b01100000</span>;
|
||
<span class="kw">let </span>after = <span class="number">0b11111111</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[before]);
|
||
bv.set_all();
|
||
<span class="macro">assert_eq!</span>(bv, BitVec::from_bytes(<span class="kw-2">&</span>[after]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.negate" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#814-820">Source</a><h4 class="code-header">pub fn <a href="#method.negate" class="fn">negate</a>(&mut self)</h4></section></summary><div class="docblock"><p>Flips all bits.</p>
|
||
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>before = <span class="number">0b01100000</span>;
|
||
<span class="kw">let </span>after = <span class="number">0b10011111</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[before]);
|
||
bv.negate();
|
||
<span class="macro">assert_eq!</span>(bv, BitVec::from_bytes(<span class="kw-2">&</span>[after]));</code></pre></div></div></details><details class="toggle method-toggle deprecated" open><summary><section id="method.union" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#849-851">Source</a><h4 class="code-header">pub fn <a href="#method.union" class="fn">union</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.7.0: <p>Please use the ‘or’ function instead</p>
|
||
</span></div></span></summary><div class="docblock"><p>Calculates the union of two bitvectors. This acts like the bitwise <code>or</code>
|
||
function.</p>
|
||
<p>Sets <code>self</code> to the union of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different lengths.</p>
|
||
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100100</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01011010</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b01111110</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.union(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle deprecated" open><summary><section id="method.intersect" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#880-882">Source</a><h4 class="code-header">pub fn <a href="#method.intersect" class="fn">intersect</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.7.0: <p>Please use the ‘and’ function instead</p>
|
||
</span></div></span></summary><div class="docblock"><p>Calculates the intersection of two bitvectors. This acts like the
|
||
bitwise <code>and</code> function.</p>
|
||
<p>Sets <code>self</code> to the intersection of <code>self</code> and <code>other</code>. Both bitvectors
|
||
must be the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different lengths.</p>
|
||
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100100</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01011010</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b01000000</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.intersect(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.or" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#909-913">Source</a><h4 class="code-header">pub fn <a href="#method.or" class="fn">or</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the bitwise <code>or</code> of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the union of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different lengths.</p>
|
||
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100100</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01011010</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b01111110</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.or(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.and" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#940-944">Source</a><h4 class="code-header">pub fn <a href="#method.and" class="fn">and</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the bitwise <code>and</code> of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the intersection of <code>self</code> and <code>other</code>. Both bitvectors
|
||
must be the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different lengths.</p>
|
||
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100100</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01011010</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b01000000</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.and(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.difference" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#979-983">Source</a><h4 class="code-header">pub fn <a href="#method.difference" class="fn">difference</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the difference between two bitvectors.</p>
|
||
<p>Sets each element of <code>self</code> to the value of that element minus the
|
||
element of <code>other</code> at the same index. Both bitvectors must be the same
|
||
length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different length.</p>
|
||
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100100</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01011010</span>;
|
||
<span class="kw">let </span>a_b = <span class="number">0b00100100</span>; <span class="comment">// a - b
|
||
</span><span class="kw">let </span>b_a = <span class="number">0b00011010</span>; <span class="comment">// b - a
|
||
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>bva = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>bvb = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(bva.difference(<span class="kw-2">&</span>bvb));
|
||
<span class="macro">assert_eq!</span>(bva, BitVec::from_bytes(<span class="kw-2">&</span>[a_b]));
|
||
|
||
<span class="kw">let </span>bva = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bvb = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(bvb.difference(<span class="kw-2">&</span>bva));
|
||
<span class="macro">assert_eq!</span>(bvb, BitVec::from_bytes(<span class="kw-2">&</span>[b_a]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.xor" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1010-1014">Source</a><h4 class="code-header">pub fn <a href="#method.xor" class="fn">xor</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the xor of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the xor of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different length.</p>
|
||
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100110</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01010100</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b00110010</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.xor(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.nand" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1041-1048">Source</a><h4 class="code-header">pub fn <a href="#method.nand" class="fn">nand</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the nand of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the nand of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different length.</p>
|
||
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100110</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01010100</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b10111011</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.nand(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.nor" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1075-1082">Source</a><h4 class="code-header">pub fn <a href="#method.nor" class="fn">nor</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the nor of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the nor of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different length.</p>
|
||
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100110</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01010100</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b10001001</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.nor(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.xnor" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1109-1116">Source</a><h4 class="code-header">pub fn <a href="#method.xnor" class="fn">xnor</a>(&mut self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Calculates the xnor of two bitvectors.</p>
|
||
<p>Sets <code>self</code> to the xnor of <code>self</code> and <code>other</code>. Both bitvectors must be
|
||
the same length. Returns <code>true</code> if <code>self</code> changed.</p>
|
||
<h5 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h5>
|
||
<p>Panics if the bitvectors are of different length.</p>
|
||
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>a = <span class="number">0b01100110</span>;
|
||
<span class="kw">let </span>b = <span class="number">0b01010100</span>;
|
||
<span class="kw">let </span>res = <span class="number">0b11001101</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[a]);
|
||
<span class="kw">let </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[b]);
|
||
|
||
<span class="macro">assert!</span>(a.xnor(<span class="kw-2">&</span>b));
|
||
<span class="macro">assert_eq!</span>(a, BitVec::from_bytes(<span class="kw-2">&</span>[res]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.all" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1132-1142">Source</a><h4 class="code-header">pub fn <a href="#method.all" class="fn">all</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if all bits are 1.</p>
|
||
<h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">5</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.all(), <span class="bool-val">true</span>);
|
||
|
||
bv.set(<span class="number">1</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.all(), <span class="bool-val">false</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.count_ones" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1161-1165">Source</a><h4 class="code-header">pub fn <a href="#method.count_ones" class="fn">count_ones</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the number of ones in the binary representation.</p>
|
||
<p>Also known as the
|
||
<a href="https://en.wikipedia.org/wiki/Hamming_weight">Hamming weight</a>.</p>
|
||
<h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">100</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.count_ones(), <span class="number">100</span>);
|
||
|
||
bv.set(<span class="number">50</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.count_ones(), <span class="number">99</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.count_zeros" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1184-1192">Source</a><h4 class="code-header">pub fn <a href="#method.count_zeros" class="fn">count_zeros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the number of zeros in the binary representation.</p>
|
||
<p>Also known as the opposite of
|
||
<a href="https://en.wikipedia.org/wiki/Hamming_weight">Hamming weight</a>.</p>
|
||
<h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">100</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.count_zeros(), <span class="number">100</span>);
|
||
|
||
bv.set(<span class="number">50</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.count_zeros(), <span class="number">99</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1205-1211">Source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="struct.Iter.html" title="struct bit_vec::Iter">Iter</a><'_, B> <a href="#" class="tooltip" data-notable-ty="Iter<'_, B>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over the elements of the vector in order.</p>
|
||
<h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01110100</span>, <span class="number">0b10010010</span>]);
|
||
<span class="macro">assert_eq!</span>(bv.iter().filter(|x| <span class="kw-2">*</span>x).count(), <span class="number">7</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter_mut" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1229-1236">Source</a><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fn">iter_mut</a>(&mut self) -> <a class="struct" href="struct.IterMut.html" title="struct bit_vec::IterMut">IterMut</a><'_, B> <a href="#" class="tooltip" data-notable-ty="IterMut<'_, B>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over mutable smart pointers to the elements of the vector in order.</p>
|
||
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_elem(<span class="number">8</span>, <span class="bool-val">false</span>);
|
||
a.iter_mut().enumerate().for_each(|(index, <span class="kw-2">mut </span>bit)| {
|
||
<span class="kw-2">*</span>bit = <span class="kw">if </span>index % <span class="number">2 </span>== <span class="number">1 </span>{ <span class="bool-val">true </span>} <span class="kw">else </span>{ <span class="bool-val">false </span>};
|
||
});
|
||
<span class="macro">assert!</span>(a.eq_vec(<span class="kw-2">&</span>[
|
||
<span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true
|
||
</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.append" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1255-1284">Source</a><h4 class="code-header">pub fn <a href="#method.append" class="fn">append</a>(&mut self, other: &mut Self)</h4></section></summary><div class="docblock"><p>Moves all bits from <code>other</code> into <code>Self</code>, leaving <code>other</code> empty.</p>
|
||
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b10000000</span>]);
|
||
<span class="kw">let </span><span class="kw-2">mut </span>b = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01100001</span>]);
|
||
|
||
a.append(<span class="kw-2">&mut </span>b);
|
||
|
||
<span class="macro">assert_eq!</span>(a.len(), <span class="number">16</span>);
|
||
<span class="macro">assert_eq!</span>(b.len(), <span class="number">0</span>);
|
||
<span class="macro">assert!</span>(a.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_off" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1310-1348">Source</a><h4 class="code-header">pub fn <a href="#method.split_off" class="fn">split_off</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Splits the <code>BitVec</code> into two at the given bit,
|
||
retaining the first half in-place and returning the second one.</p>
|
||
<h5 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h5>
|
||
<p>Panics if <code>at</code> is out of bounds.</p>
|
||
<h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = BitVec::new();
|
||
a.push(<span class="bool-val">true</span>);
|
||
a.push(<span class="bool-val">false</span>);
|
||
a.push(<span class="bool-val">false</span>);
|
||
a.push(<span class="bool-val">true</span>);
|
||
|
||
<span class="kw">let </span>b = a.split_off(<span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(a.len(), <span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(b.len(), <span class="number">2</span>);
|
||
<span class="macro">assert!</span>(a.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>]));
|
||
<span class="macro">assert!</span>(b.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.none" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1364-1366">Source</a><h4 class="code-header">pub fn <a href="#method.none" class="fn">none</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if all bits are 0.</p>
|
||
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">10</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.none(), <span class="bool-val">true</span>);
|
||
|
||
bv.set(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.none(), <span class="bool-val">false</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.any" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1382-1384">Source</a><h4 class="code-header">pub fn <a href="#method.any" class="fn">any</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if any bit is 1.</p>
|
||
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">10</span>, <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(bv.any(), <span class="bool-val">false</span>);
|
||
|
||
bv.set(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.any(), <span class="bool-val">true</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.to_bytes" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1407-1437">Source</a><h4 class="code-header">pub fn <a href="#method.to_bytes" class="fn">to_bytes</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>></h4></section></summary><div class="docblock"><p>Organises the bits into bytes, such that the first bit in the
|
||
<code>BitVec</code> becomes the high-order bit of the first byte. If the
|
||
size of the <code>BitVec</code> is not a multiple of eight then trailing bits
|
||
will be filled-in with <code>false</code>.</p>
|
||
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
bv.set(<span class="number">1</span>, <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bv.to_bytes(), [<span class="number">0b10100000</span>]);
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">9</span>, <span class="bool-val">false</span>);
|
||
bv.set(<span class="number">2</span>, <span class="bool-val">true</span>);
|
||
bv.set(<span class="number">8</span>, <span class="bool-val">true</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bv.to_bytes(), [<span class="number">0b00100000</span>, <span class="number">0b10000000</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.eq_vec" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1457-1460">Source</a><h4 class="code-header">pub fn <a href="#method.eq_vec" class="fn">eq_vec</a>(&self, v: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Compares a <code>BitVec</code> to a slice of <code>bool</code>s.
|
||
Both the <code>BitVec</code> and slice must have the same length.</p>
|
||
<h5 id="panics-11"><a class="doc-anchor" href="#panics-11">§</a>Panics</h5>
|
||
<p>Panics if the <code>BitVec</code> and slice are of different length.</p>
|
||
<h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b10100000</span>]);
|
||
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>, <span class="bool-val">false</span>,
|
||
<span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.truncate" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1477-1485">Source</a><h4 class="code-header">pub fn <a href="#method.truncate" class="fn">truncate</a>(&mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shortens a <code>BitVec</code>, dropping excess elements.</p>
|
||
<p>If <code>len</code> is greater than the vector’s current length, this has no
|
||
effect.</p>
|
||
<h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01001011</span>]);
|
||
bv.truncate(<span class="number">2</span>);
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reserve" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1505-1515">Source</a><h4 class="code-header">pub fn <a href="#method.reserve" class="fn">reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more bits to be inserted in the given
|
||
<code>BitVec</code>. The collection may reserve more space to avoid frequent reallocations.</p>
|
||
<h5 id="panics-12"><a class="doc-anchor" href="#panics-12">§</a>Panics</h5>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
<h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">3</span>, <span class="bool-val">false</span>);
|
||
bv.reserve(<span class="number">10</span>);
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">3</span>);
|
||
<span class="macro">assert!</span>(bv.capacity() >= <span class="number">13</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reserve_exact" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1539-1549">Source</a><h4 class="code-header">pub fn <a href="#method.reserve_exact" class="fn">reserve_exact</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Reserves the minimum capacity for exactly <code>additional</code> more bits to be inserted in the
|
||
given <code>BitVec</code>. Does nothing if the capacity is already sufficient.</p>
|
||
<p>Note that the allocator may give the collection more space than it requests. Therefore
|
||
capacity can not be relied upon to be precisely minimal. Prefer <code>reserve</code> if future
|
||
insertions are expected.</p>
|
||
<h5 id="panics-13"><a class="doc-anchor" href="#panics-13">§</a>Panics</h5>
|
||
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
||
<h5 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_elem(<span class="number">3</span>, <span class="bool-val">false</span>);
|
||
bv.reserve(<span class="number">10</span>);
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">3</span>);
|
||
<span class="macro">assert!</span>(bv.capacity() >= <span class="number">13</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1564-1566">Source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the capacity in bits for this bit vector. Inserting any
|
||
element less than this amount will not trigger a resizing.</p>
|
||
<h5 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::new();
|
||
bv.reserve(<span class="number">10</span>);
|
||
<span class="macro">assert!</span>(bv.capacity() >= <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.grow" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1584-1623">Source</a><h4 class="code-header">pub fn <a href="#method.grow" class="fn">grow</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Grows the <code>BitVec</code> in-place, adding <code>n</code> copies of <code>value</code> to the <code>BitVec</code>.</p>
|
||
<h5 id="panics-14"><a class="doc-anchor" href="#panics-14">§</a>Panics</h5>
|
||
<p>Panics if the new len overflows a <code>usize</code>.</p>
|
||
<h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01001011</span>]);
|
||
bv.grow(<span class="number">2</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">10</span>);
|
||
<span class="macro">assert_eq!</span>(bv.to_bytes(), [<span class="number">0b01001011</span>, <span class="number">0b11000000</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.pop" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1638-1655">Source</a><h4 class="code-header">pub fn <a href="#method.pop" class="fn">pop</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>></h4></section></summary><div class="docblock"><p>Removes the last bit from the <code>BitVec</code>, and returns it. Returns <code>None</code> if the <code>BitVec</code> is empty.</p>
|
||
<h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::from_bytes(<span class="kw-2">&</span>[<span class="number">0b01001001</span>]);
|
||
<span class="macro">assert_eq!</span>(bv.pop(), <span class="prelude-val">Some</span>(<span class="bool-val">true</span>));
|
||
<span class="macro">assert_eq!</span>(bv.pop(), <span class="prelude-val">Some</span>(<span class="bool-val">false</span>));
|
||
<span class="macro">assert_eq!</span>(bv.len(), <span class="number">6</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.push" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1670-1677">Source</a><h4 class="code-header">pub fn <a href="#method.push" class="fn">push</a>(&mut self, elem: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Pushes a <code>bool</code> onto the end.</p>
|
||
<h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bv = BitVec::new();
|
||
bv.push(<span class="bool-val">true</span>);
|
||
bv.push(<span class="bool-val">false</span>);
|
||
<span class="macro">assert!</span>(bv.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1681-1683">Source</a><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the total number of bits in this vector</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_len" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1691-1693">Source</a><h4 class="code-header">pub unsafe fn <a href="#method.set_len" class="fn">set_len</a>(&mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Sets the number of bits that this <code>BitVec</code> considers initialized.</p>
|
||
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5>
|
||
<p>Almost certainly can cause bad stuff. Only really intended for <code>BitSet</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1697-1699">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if there are no bits in this vector</p>
|
||
</div></details><details class="toggle method-toggle deprecated" open><summary><section id="method.clear" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1704-1709">Source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fn">clear</a>(&mut self)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.9.0: <p>please use <code>.fill(false)</code> instead</p>
|
||
</span></div></span></summary><div class="docblock"><p>Clears all bits in this vector.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fill" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1721-1730">Source</a><h4 class="code-header">pub fn <a href="#method.fill" class="fn">fill</a>(&mut self, bit: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Assigns all bits in this vector to the given boolean value.</p>
|
||
<h5 id="invariants"><a class="doc-anchor" href="#invariants">§</a>Invariants</h5>
|
||
<ul>
|
||
<li>After a call to <code>.fill(true)</code>, the result of <a href="struct.BitVec.html#method.all" title="method bit_vec::BitVec::all"><code>all</code></a> is <code>true</code>.</li>
|
||
<li>After a call to <code>.fill(false)</code>, the result of <a href="struct.BitVec.html#method.none" title="method bit_vec::BitVec::none"><code>none</code></a> is <code>true</code>.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink_to_fit" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1738-1740">Source</a><h4 class="code-header">pub fn <a href="#method.shrink_to_fit" class="fn">shrink_to_fit</a>(&mut self)</h4></section></summary><div class="docblock"><p>Shrinks the capacity of the underlying storage as much as
|
||
possible.</p>
|
||
<p>It will drop down as close as possible to the length but the
|
||
allocator may still inform the underlying storage that there
|
||
is space for a few more elements/bits.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.insert" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1766-1796">Source</a><h4 class="code-header">pub fn <a href="#method.insert" class="fn">insert</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>, bit: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Inserts a given bit at index <code>at</code>, shifting all bits after by one</p>
|
||
<h5 id="panics-15"><a class="doc-anchor" href="#panics-15">§</a>Panics</h5>
|
||
<p>Panics if <code>at</code> is out of bounds for <code>BitVec</code>’s length (that is, if <code>at > BitVec::len()</code>)</p>
|
||
<h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code> <span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>b = BitVec::new();
|
||
|
||
b.push(<span class="bool-val">true</span>);
|
||
b.push(<span class="bool-val">true</span>);
|
||
b.insert(<span class="number">1</span>, <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert!</span>(b.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div><h5 id="time-complexity"><a class="doc-anchor" href="#time-complexity">§</a>Time complexity</h5>
|
||
<p>Takes O(<a href="struct.BitVec.html#method.len" title="method bit_vec::BitVec::len"><code>len</code></a>) time. All items after the insertion index must be
|
||
shifted to the right. In the worst case, all elements are shifted when
|
||
the insertion index is 0.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1824-1859">Source</a><h4 class="code-header">pub fn <a href="#method.remove" class="fn">remove</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Remove a bit at index <code>at</code>, shifting all bits after by one.</p>
|
||
<h5 id="panics-16"><a class="doc-anchor" href="#panics-16">§</a>Panics</h5>
|
||
<p>Panics if <code>at</code> is out of bounds for <code>BitVec</code>’s length (that is, if <code>at >= BitVec::len()</code>)</p>
|
||
<h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code> <span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>b = BitVec::new();
|
||
|
||
b.push(<span class="bool-val">true</span>);
|
||
b.push(<span class="bool-val">false</span>);
|
||
b.push(<span class="bool-val">false</span>);
|
||
b.push(<span class="bool-val">true</span>);
|
||
<span class="macro">assert!</span>(!b.remove(<span class="number">1</span>));
|
||
|
||
<span class="macro">assert!</span>(b.eq_vec(<span class="kw-2">&</span>[<span class="bool-val">true</span>, <span class="bool-val">false</span>, <span class="bool-val">true</span>]));</code></pre></div><h5 id="time-complexity-1"><a class="doc-anchor" href="#time-complexity-1">§</a>Time complexity</h5>
|
||
<p>Takes O(<a href="struct.BitVec.html#method.len" title="method bit_vec::BitVec::len"><code>len</code></a>) time. All items after the removal index must be
|
||
shifted to the left. In the worst case, all elements are shifted when
|
||
the removal index is 0.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_all" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1868-1871">Source</a><h4 class="code-header">pub fn <a href="#method.remove_all" class="fn">remove_all</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all bits in this vector.</p>
|
||
<p>Note: this method is not named <a href="struct.BitVec.html#method.clear" title="method bit_vec::BitVec::clear"><code>clear</code></a> to avoid confusion whenever <a href="struct.BitVec.html#method.fill" title="method bit_vec::BitVec::fill"><code>.fill(false)</code></a>
|
||
is needed.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.push_within_capacity" class="method"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1905-1929">Source</a><h4 class="code-header">pub fn <a href="#method.push_within_capacity" class="fn">push_within_capacity</a>(&mut self, bit: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</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="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>></h4></section></summary><div class="docblock"><p>Appends an element if there is sufficient spare capacity, otherwise an error is returned
|
||
with the element.</p>
|
||
<p>Unlike <a href="struct.BitVec.html#method.push" title="method bit_vec::BitVec::push"><code>push</code></a> this method will not reallocate when there’s insufficient capacity.
|
||
The caller should use <a href="struct.BitVec.html#method.reserve" title="method bit_vec::BitVec::reserve"><code>reserve</code></a> to ensure that there is enough capacity.</p>
|
||
<h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bit_vec::BitVec;
|
||
|
||
<span class="kw">let </span>initial_capacity = <span class="number">64</span>;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bitvec = BitVec::with_capacity(<span class="number">64</span>);
|
||
|
||
<span class="kw">for _ in </span><span class="number">0</span>..initial_capacity - <span class="number">1 </span>{
|
||
bitvec.push(<span class="bool-val">false</span>);
|
||
}
|
||
|
||
<span class="macro">assert_eq!</span>(bitvec.len(), initial_capacity - <span class="number">1</span>); <span class="comment">// there is space for only 1 bit
|
||
|
||
</span><span class="macro">assert_eq!</span>(bitvec.push_within_capacity(<span class="bool-val">true</span>), <span class="prelude-val">Ok</span>(())); <span class="comment">// Successfully push a bit
|
||
</span><span class="macro">assert_eq!</span>(bitvec.len(), initial_capacity); <span class="comment">// So we can't push within capacity anymore
|
||
|
||
</span><span class="macro">assert_eq!</span>(bitvec.push_within_capacity(<span class="bool-val">true</span>), <span class="prelude-val">Err</span>(<span class="bool-val">true</span>));
|
||
<span class="macro">assert_eq!</span>(bitvec.len(), initial_capacity);
|
||
<span class="macro">assert_eq!</span>(bitvec.capacity(), initial_capacity);</code></pre></div><h5 id="time-complexity-2"><a class="doc-anchor" href="#time-complexity-2">§</a>Time Complexity</h5>
|
||
<p>Takes <em>O(1)</em> time.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1964-1980">Source</a><a href="#impl-Clone-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1966-1972">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> Self</h4></section></summary><div class='docblock'>Returns a duplicate of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1975-1979">Source</a><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2020-2035">Source</a><a href="#impl-Debug-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2021-2034">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, fmt: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1932-1940">Source</a><a href="#impl-Default-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1934-1939">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2010-2018">Source</a><a href="#impl-Display-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2011-2017">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, fmt: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Extend%3Cbool%3E-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1951-1962">Source</a><a href="#impl-Extend%3Cbool%3E-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.extend" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1953-1961">Source</a><a href="#method.extend" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#tymethod.extend" class="fn">extend</a><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>>>(&mut self, iterable: I)</h4></section></summary><div class='docblock'>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#tymethod.extend">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.extend_one" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#420">Source</a><a href="#method.extend_one" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_one" class="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><div class='docblock'>Extends a collection with exactly one element.</div></details><details class="toggle method-toggle" open><summary><section id="method.extend_reserve" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/iter/traits/collect.rs.html#428">Source</a><a href="#method.extend_reserve" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_reserve" class="fn">extend_reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><div class='docblock'>Reserves capacity in a collection for the given number of additional elements. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html#method.extend_reserve">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromIterator%3Cbool%3E-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1942-1949">Source</a><a href="#impl-FromIterator%3Cbool%3E-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html" title="trait core::iter::traits::collect::FromIterator">FromIterator</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_iter" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1944-1948">Source</a><a href="#method.from_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter" class="fn">from_iter</a><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a>>>(iter: I) -> Self</h4></section></summary><div class='docblock'>Creates a value from an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html#tymethod.from_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2037-2046">Source</a><a href="#impl-Hash-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2039-2045">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&mut H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#234-236">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a><H>(data: &[Self], state: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&mut H</a>)<div class="where">where
|
||
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3Cusize%3E-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#268-279">Source</a><a href="#impl-Index%3Cusize%3E-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#269">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#272-278">Source</a><a href="#method.index" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, i: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a>) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2179-2187">Source</a><a href="#impl-IntoIterator-for-%26BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<'a, B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2180">Source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2181">Source</a><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.Iter.html" title="struct bit_vec::Iter">Iter</a><'a, B></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2184-2186">Source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.Iter.html" title="struct bit_vec::Iter">Iter</a><'a, B> <a href="#" class="tooltip" data-notable-ty="Iter<'a, B>">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2212-2224">Source</a><a href="#impl-IntoIterator-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2213">Source</a><a href="#associatedtype.Item-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2214">Source</a><a href="#associatedtype.IntoIter-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.IntoIter.html" title="struct bit_vec::IntoIter">IntoIter</a><B></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter-1" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2217-2223">Source</a><a href="#method.into_iter-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.IntoIter.html" title="struct bit_vec::IntoIter">IntoIter</a><B> <a href="#" class="tooltip" data-notable-ty="IntoIter<B>">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1989-2008">Source</a><a href="#impl-Ord-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1991-2007">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1033-1035">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1072-1074">Source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1098-1100">Source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2048-2058">Source</a><a href="#impl-PartialEq-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2050-2057">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &Self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#263">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1982-1987">Source</a><a href="#impl-PartialOrd-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#1984-1986">Source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>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></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1409">Source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1427">Source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1445">Source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1463">Source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details></div></details><section id="impl-Eq-for-BitVec%3CB%3E" class="impl"><a class="src rightside" href="../src/bit_vec/lib.rs.html#2060">Source</a><a href="#impl-Eq-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BitBlock.html" title="trait bit_vec::BitBlock">BitBlock</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-BitVec%3CB%3E" class="impl"><a href="#impl-Freeze-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section><section id="impl-RefUnwindSafe-for-BitVec%3CB%3E" class="impl"><a href="#impl-RefUnwindSafe-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B><div class="where">where
|
||
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-BitVec%3CB%3E" class="impl"><a href="#impl-Send-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B><div class="where">where
|
||
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-BitVec%3CB%3E" class="impl"><a href="#impl-Sync-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B><div class="where">where
|
||
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-BitVec%3CB%3E" class="impl"><a href="#impl-Unpin-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <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="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B><div class="where">where
|
||
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnsafeUnpin-for-BitVec%3CB%3E" class="impl"><a href="#impl-UnsafeUnpin-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.UnsafeUnpin.html" title="trait core::marker::UnsafeUnpin">UnsafeUnpin</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B></h3></section><section id="impl-UnwindSafe-for-BitVec%3CB%3E" class="impl"><a href="#impl-UnwindSafe-for-BitVec%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BitVec.html" title="struct bit_vec::BitVec">BitVec</a><B><div class="where">where
|
||
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#141">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#142">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">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></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#547">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#549">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dest</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">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</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#72-74">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#76">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#77">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2891">Source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2893">Source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">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<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"Blocks<'_, B>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Blocks.html\" title=\"struct bit_vec::Blocks\">Blocks</a><'_, B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.BitBlock.html\" title=\"trait bit_vec::BitBlock\">BitBlock</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Blocks.html\" title=\"struct bit_vec::Blocks\">Blocks</a><'_, B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = B;</div>","IntoIter<B>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct bit_vec::IntoIter\">IntoIter</a><B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.BitBlock.html\" title=\"trait bit_vec::BitBlock\">BitBlock</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct bit_vec::IntoIter\">IntoIter</a><B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/core/primitive.bool.html\">bool</a>;</div>","Iter<'_, B>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Iter.html\" title=\"struct bit_vec::Iter\">Iter</a><'_, B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.BitBlock.html\" title=\"trait bit_vec::BitBlock\">BitBlock</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Iter.html\" title=\"struct bit_vec::Iter\">Iter</a><'_, B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/core/primitive.bool.html\">bool</a>;</div>","Iter<'a, B>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Iter.html\" title=\"struct bit_vec::Iter\">Iter</a><'_, B></code></h3><pre><code><div class=\"where\">impl<B: <a class=\"trait\" href=\"trait.BitBlock.html\" title=\"trait bit_vec::BitBlock\">BitBlock</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Iter.html\" title=\"struct bit_vec::Iter\">Iter</a><'_, B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/core/primitive.bool.html\">bool</a>;</div>","IterMut<'_, B>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct bit_vec::IterMut\">IterMut</a><'a, B></code></h3><pre><code><div class=\"where\">impl<'a, B: <a class=\"trait\" href=\"trait.BitBlock.html\" title=\"trait bit_vec::BitBlock\">BitBlock</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IterMut.html\" title=\"struct bit_vec::IterMut\">IterMut</a><'a, B></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"struct.MutBorrowedBit.html\" title=\"struct bit_vec::MutBorrowedBit\">MutBorrowedBit</a><'a, B>;</div>"}</script></section></div></main></body></html> |