mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-15 09:42:58 +00:00
3499 lines
720 KiB
HTML
3499 lines
720 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="Bit-Addressable Memory"><title>BitSlice in common_base::bit_vec::prelude - 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-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="common_base" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.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"><!--[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="#">BitSlice</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../common_base/index.html">common_<wbr>base</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">BitSlice</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#bit-addressable-memory" title="Bit-Addressable Memory">Bit-Addressable Memory</a><ul><li><a href="#documentation" title="Documentation">Documentation</a></li><li><a href="#original" title="Original">Original</a></li><li><a href="#api-differences" title="API Differences">API Differences</a></li><li><a href="#behavior" title="Behavior">Behavior</a></li><li><a href="#type-parameters" title="Type Parameters">Type Parameters</a></li><li><a href="#safety" title="Safety">Safety</a></li><li><a href="#performance" title="Performance">Performance</a></li><li><a href="#construction" title="Construction">Construction</a></li><li><a href="#usage" title="Usage">Usage</a></li><li><a href="#trait-implementations-1" title="Trait Implementations">Trait Implementations</a></li></ul></li></ul><h3><a href="#fields">Fields</a></h3><ul class="block structfield"><li><a href="#structfield._mem" title="_mem">_mem</a></li><li><a href="#structfield._ord" title="_ord">_ord</a></li><li><a href="#structfield._typ" title="_typ">_typ</a></li></ul><h3><a href="#implementations">Associated Constants</a></h3><ul class="block associatedconstant"><li><a href="#associatedconstant.MAX_BITS" title="MAX_BITS">MAX_BITS</a></li><li><a href="#associatedconstant.MAX_ELTS" title="MAX_ELTS">MAX_ELTS</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.align_to" title="align_to">align_to</a></li><li><a href="#method.align_to_mut" title="align_to_mut">align_to_mut</a></li><li><a href="#method.all" title="all">all</a></li><li><a href="#method.any" title="any">any</a></li><li><a href="#method.as_bitptr" title="as_bitptr">as_bitptr</a></li><li><a href="#method.as_bitptr_range" title="as_bitptr_range">as_bitptr_range</a></li><li><a href="#method.as_mut_bitptr" title="as_mut_bitptr">as_mut_bitptr</a></li><li><a href="#method.as_mut_bitptr_range" title="as_mut_bitptr_range">as_mut_bitptr_range</a></li><li><a href="#method.as_mut_ptr" title="as_mut_ptr">as_mut_ptr</a></li><li><a href="#method.as_mut_ptr_range" title="as_mut_ptr_range">as_mut_ptr_range</a></li><li><a href="#method.as_ptr" title="as_ptr">as_ptr</a></li><li><a href="#method.as_ptr_range" title="as_ptr_range">as_ptr_range</a></li><li><a href="#method.bit_domain" title="bit_domain">bit_domain</a></li><li><a href="#method.bit_domain_mut" title="bit_domain_mut">bit_domain_mut</a></li><li><a href="#method.chunks" title="chunks">chunks</a></li><li><a href="#method.chunks_exact" title="chunks_exact">chunks_exact</a></li><li><a href="#method.chunks_exact_mut" title="chunks_exact_mut">chunks_exact_mut</a></li><li><a href="#method.chunks_mut" title="chunks_mut">chunks_mut</a></li><li><a href="#method.clone_from_bitslice" title="clone_from_bitslice">clone_from_bitslice</a></li><li><a href="#method.clone_from_slice" title="clone_from_slice">clone_from_slice</a></li><li><a href="#method.contains" title="contains">contains</a></li><li><a href="#method.copy_from_bitslice" title="copy_from_bitslice">copy_from_bitslice</a></li><li><a href="#method.copy_from_slice" title="copy_from_slice">copy_from_slice</a></li><li><a href="#method.copy_within" title="copy_within">copy_within</a></li><li><a href="#method.copy_within_unchecked" title="copy_within_unchecked">copy_within_unchecked</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.domain" title="domain">domain</a></li><li><a href="#method.domain_mut" title="domain_mut">domain_mut</a></li><li><a href="#method.empty" title="empty">empty</a></li><li><a href="#method.empty_mut" title="empty_mut">empty_mut</a></li><li><a href="#method.ends_with" title="ends_with">ends_with</a></li><li><a href="#method.fill" title="fill">fill</a></li><li><a href="#method.fill_with" title="fill_with">fill_with</a></li><li><a href="#method.first" title="first">first</a></li><li><a href="#method.first_mut" title="first_mut">first_mut</a></li><li><a href="#method.first_one" title="first_one">first_one</a></li><li><a href="#method.first_zero" title="first_zero">first_zero</a></li><li><a href="#method.from_element" title="from_element">from_element</a></li><li><a href="#method.from_element_mut" title="from_element_mut">from_element_mut</a></li><li><a href="#method.from_slice" title="from_slice">from_slice</a></li><li><a href="#method.from_slice_mut" title="from_slice_mut">from_slice_mut</a></li><li><a href="#method.from_slice_unchecked" title="from_slice_unchecked">from_slice_unchecked</a></li><li><a href="#method.from_slice_unchecked_mut" title="from_slice_unchecked_mut">from_slice_unchecked_mut</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.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.iter_ones" title="iter_ones">iter_ones</a></li><li><a href="#method.iter_zeros" title="iter_zeros">iter_zeros</a></li><li><a href="#method.last" title="last">last</a></li><li><a href="#method.last_mut" title="last_mut">last_mut</a></li><li><a href="#method.last_one" title="last_one">last_one</a></li><li><a href="#method.last_zero" title="last_zero">last_zero</a></li><li><a href="#method.leading_ones" title="leading_ones">leading_ones</a></li><li><a href="#method.leading_zeros" title="leading_zeros">leading_zeros</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.not_all" title="not_all">not_all</a></li><li><a href="#method.not_any" title="not_any">not_any</a></li><li><a href="#method.rchunks" title="rchunks">rchunks</a></li><li><a href="#method.rchunks_exact" title="rchunks_exact">rchunks_exact</a></li><li><a href="#method.rchunks_exact_mut" title="rchunks_exact_mut">rchunks_exact_mut</a></li><li><a href="#method.rchunks_mut" title="rchunks_mut">rchunks_mut</a></li><li><a href="#method.repeat" title="repeat">repeat</a></li><li><a href="#method.replace" title="replace">replace</a></li><li><a href="#method.replace_unchecked" title="replace_unchecked">replace_unchecked</a></li><li><a href="#method.reverse" title="reverse">reverse</a></li><li><a href="#method.rotate_left" title="rotate_left">rotate_left</a></li><li><a href="#method.rotate_right" title="rotate_right">rotate_right</a></li><li><a href="#method.rsplit" title="rsplit">rsplit</a></li><li><a href="#method.rsplit_mut" title="rsplit_mut">rsplit_mut</a></li><li><a href="#method.rsplitn" title="rsplitn">rsplitn</a></li><li><a href="#method.rsplitn_mut" title="rsplitn_mut">rsplitn_mut</a></li><li><a href="#method.set" title="set">set</a></li><li><a href="#method.set_aliased" title="set_aliased">set_aliased</a></li><li><a href="#method.set_aliased_unchecked" title="set_aliased_unchecked">set_aliased_unchecked</a></li><li><a href="#method.set_unchecked" title="set_unchecked">set_unchecked</a></li><li><a href="#method.shift_left" title="shift_left">shift_left</a></li><li><a href="#method.shift_right" title="shift_right">shift_right</a></li><li><a href="#method.some" title="some">some</a></li><li><a href="#method.split" title="split">split</a></li><li><a href="#method.split_at" title="split_at">split_at</a></li><li><a href="#method.split_at_mut" title="split_at_mut">split_at_mut</a></li><li><a href="#method.split_at_unchecked" title="split_at_unchecked">split_at_unchecked</a></li><li><a href="#method.split_at_unchecked_mut" title="split_at_unchecked_mut">split_at_unchecked_mut</a></li><li><a href="#method.split_first" title="split_first">split_first</a></li><li><a href="#method.split_first_mut" title="split_first_mut">split_first_mut</a></li><li><a href="#method.split_inclusive" title="split_inclusive">split_inclusive</a></li><li><a href="#method.split_inclusive_mut" title="split_inclusive_mut">split_inclusive_mut</a></li><li><a href="#method.split_last" title="split_last">split_last</a></li><li><a href="#method.split_last_mut" title="split_last_mut">split_last_mut</a></li><li><a href="#method.split_mut" title="split_mut">split_mut</a></li><li><a href="#method.splitn" title="splitn">splitn</a></li><li><a href="#method.splitn_mut" title="splitn_mut">splitn_mut</a></li><li><a href="#method.starts_with" title="starts_with">starts_with</a></li><li><a href="#method.strip_prefix" title="strip_prefix">strip_prefix</a></li><li><a href="#method.strip_suffix" title="strip_suffix">strip_suffix</a></li><li><a href="#method.swap" title="swap">swap</a></li><li><a href="#method.swap_unchecked" title="swap_unchecked">swap_unchecked</a></li><li><a href="#method.swap_with_bitslice" title="swap_with_bitslice">swap_with_bitslice</a></li><li><a href="#method.swap_with_slice" title="swap_with_slice">swap_with_slice</a></li><li><a href="#method.to_bitvec" title="to_bitvec">to_bitvec</a></li><li><a href="#method.to_vec" title="to_vec">to_vec</a></li><li><a href="#method.trailing_ones" title="trailing_ones">trailing_ones</a></li><li><a href="#method.trailing_zeros" title="trailing_zeros">trailing_zeros</a></li><li><a href="#method.try_from_slice" title="try_from_slice">try_from_slice</a></li><li><a href="#method.try_from_slice_mut" title="try_from_slice_mut">try_from_slice_mut</a></li><li><a href="#method.windows" title="windows">windows</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" title="AsMut<BitSlice<<A as BitView>::Store, O>>">AsMut<BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" title="AsMut<BitSlice<T, O>>">AsMut<BitSlice<T, O>></a></li><li><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="AsMut<BitSlice<T, O>>">AsMut<BitSlice<T, O>></a></li><li><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="AsMut<BitSlice<T, O>>">AsMut<BitSlice<T, O>></a></li><li><a href="#impl-AsRef%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" title="AsRef<BitSlice<<A as BitView>::Store, O>>">AsRef<BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" title="AsRef<BitSlice<T, O>>">AsRef<BitSlice<T, O>></a></li><li><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="AsRef<BitSlice<T, O>>">AsRef<BitSlice<T, O>></a></li><li><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="AsRef<BitSlice<T, O>>">AsRef<BitSlice<T, O>></a></li><li><a href="#impl-Binary-for-BitSlice%3CT,+O%3E" title="Binary">Binary</a></li><li><a href="#impl-BitAndAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitAndAssign<&BitArray<A, O>>">BitAndAssign<&BitArray<A, O>></a></li><li><a href="#impl-BitAndAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitAndAssign<&BitBox<T, O>>">BitAndAssign<&BitBox<T, O>></a></li><li><a href="#impl-BitAndAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="BitAndAssign<&BitSlice<T2, O2>>">BitAndAssign<&BitSlice<T2, O2>></a></li><li><a href="#impl-BitAndAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitAndAssign<&BitVec<T, O>>">BitAndAssign<&BitVec<T, O>></a></li><li><a href="#impl-BitAndAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitAndAssign<BitArray<A, O>>">BitAndAssign<BitArray<A, O>></a></li><li><a href="#impl-BitAndAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitAndAssign<BitBox<T, O>>">BitAndAssign<BitBox<T, O>></a></li><li><a href="#impl-BitAndAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitAndAssign<BitVec<T, O>>">BitAndAssign<BitVec<T, O>></a></li><li><a href="#impl-BitField-for-BitSlice%3CT%3E" title="BitField">BitField</a></li><li><a href="#impl-BitField-for-BitSlice%3CT,+Msb0%3E" title="BitField">BitField</a></li><li><a href="#impl-BitOrAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitOrAssign<&BitArray<A, O>>">BitOrAssign<&BitArray<A, O>></a></li><li><a href="#impl-BitOrAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitOrAssign<&BitBox<T, O>>">BitOrAssign<&BitBox<T, O>></a></li><li><a href="#impl-BitOrAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="BitOrAssign<&BitSlice<T2, O2>>">BitOrAssign<&BitSlice<T2, O2>></a></li><li><a href="#impl-BitOrAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitOrAssign<&BitVec<T, O>>">BitOrAssign<&BitVec<T, O>></a></li><li><a href="#impl-BitOrAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitOrAssign<BitArray<A, O>>">BitOrAssign<BitArray<A, O>></a></li><li><a href="#impl-BitOrAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitOrAssign<BitBox<T, O>>">BitOrAssign<BitBox<T, O>></a></li><li><a href="#impl-BitOrAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitOrAssign<BitVec<T, O>>">BitOrAssign<BitVec<T, O>></a></li><li><a href="#impl-BitXorAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitXorAssign<&BitArray<A, O>>">BitXorAssign<&BitArray<A, O>></a></li><li><a href="#impl-BitXorAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitXorAssign<&BitBox<T, O>>">BitXorAssign<&BitBox<T, O>></a></li><li><a href="#impl-BitXorAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="BitXorAssign<&BitSlice<T2, O2>>">BitXorAssign<&BitSlice<T2, O2>></a></li><li><a href="#impl-BitXorAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitXorAssign<&BitVec<T, O>>">BitXorAssign<&BitVec<T, O>></a></li><li><a href="#impl-BitXorAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" title="BitXorAssign<BitArray<A, O>>">BitXorAssign<BitArray<A, O>></a></li><li><a href="#impl-BitXorAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitXorAssign<BitBox<T, O>>">BitXorAssign<BitBox<T, O>></a></li><li><a href="#impl-BitXorAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="BitXorAssign<BitVec<T, O>>">BitXorAssign<BitVec<T, O>></a></li><li><a href="#impl-Borrow%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" title="Borrow<BitSlice<<A as BitView>::Store, O>>">Borrow<BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" title="Borrow<BitSlice<T, O>>">Borrow<BitSlice<T, O>></a></li><li><a href="#impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="Borrow<BitSlice<T, O>>">Borrow<BitSlice<T, O>></a></li><li><a href="#impl-BorrowMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" title="BorrowMut<BitSlice<<A as BitView>::Store, O>>">BorrowMut<BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" title="BorrowMut<BitSlice<T, O>>">BorrowMut<BitSlice<T, O>></a></li><li><a href="#impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="BorrowMut<BitSlice<T, O>>">BorrowMut<BitSlice<T, O>></a></li><li><a href="#impl-Debug-for-BitSlice%3CT,+O%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-%26BitSlice%3CT,+O%3E" title="Default">Default</a></li><li><a href="#impl-Default-for-%26mut+BitSlice%3CT,+O%3E" title="Default">Default</a></li><li><a href="#impl-Display-for-BitSlice%3CT,+O%3E" title="Display">Display</a></li><li><a href="#impl-Eq-for-BitSlice%3CT,+O%3E" title="Eq">Eq</a></li><li><a href="#impl-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" title="From<&BitSlice<T, O>>">From<&BitSlice<T, O>></a></li><li><a href="#impl-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="From<&BitSlice<T, O>>">From<&BitSlice<T, O>></a></li><li><a href="#impl-From%3C%26mut+BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" title="From<&mut BitSlice<T, O>>">From<&mut BitSlice<T, O>></a></li><li><a href="#impl-Hash-for-BitSlice%3CT,+O%3E" title="Hash">Hash</a></li><li><a href="#impl-Index%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="Index<Range<usize>>">Index<Range<usize>></a></li><li><a href="#impl-Index%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="Index<RangeFrom<usize>>">Index<RangeFrom<usize>></a></li><li><a href="#impl-Index%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" title="Index<RangeFull>">Index<RangeFull></a></li><li><a href="#impl-Index%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="Index<RangeInclusive<usize>>">Index<RangeInclusive<usize>></a></li><li><a href="#impl-Index%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="Index<RangeTo<usize>>">Index<RangeTo<usize>></a></li><li><a href="#impl-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="Index<RangeToInclusive<usize>>">Index<RangeToInclusive<usize>></a></li><li><a href="#impl-Index%3Cusize%3E-for-BitSlice%3CT,+O%3E" title="Index<usize>">Index<usize></a></li><li><a href="#impl-IndexMut%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<Range<usize>>">IndexMut<Range<usize>></a></li><li><a href="#impl-IndexMut%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<RangeFrom<usize>>">IndexMut<RangeFrom<usize>></a></li><li><a href="#impl-IndexMut%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<RangeFull>">IndexMut<RangeFull></a></li><li><a href="#impl-IndexMut%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<RangeInclusive<usize>>">IndexMut<RangeInclusive<usize>></a></li><li><a href="#impl-IndexMut%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<RangeTo<usize>>">IndexMut<RangeTo<usize>></a></li><li><a href="#impl-IndexMut%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" title="IndexMut<RangeToInclusive<usize>>">IndexMut<RangeToInclusive<usize>></a></li><li><a href="#impl-IntoIterator-for-%26BitSlice%3CT,+O%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-IntoIterator-for-%26mut+BitSlice%3CT,+O%3E" title="IntoIterator">IntoIterator</a></li><li><a href="#impl-LowerHex-for-BitSlice%3CT,+O%3E" title="LowerHex">LowerHex</a></li><li><a href="#impl-Not-for-%26mut+BitSlice%3CT,+O%3E" title="Not">Not</a></li><li><a href="#impl-Octal-for-BitSlice%3CT,+O%3E" title="Octal">Octal</a></li><li><a href="#impl-Ord-for-BitSlice%3CT,+O%3E" title="Ord">Ord</a></li><li><a href="#impl-PartialEq%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialEq<&BitSlice<T2, O2>>">PartialEq<&BitSlice<T2, O2>></a></li><li><a href="#impl-PartialEq%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialEq<&mut BitSlice<T2, O2>>">PartialEq<&mut BitSlice<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitArray%3CA,+O2%3E%3E-for-BitSlice%3CT,+O1%3E" title="PartialEq<BitArray<A, O2>>">PartialEq<BitArray<A, O2>></a></li><li><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialEq<BitBox<T2, O2>>">PartialEq<BitBox<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialEq<BitBox<T2, O2>>">PartialEq<BitBox<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialEq<BitBox<T2, O2>>">PartialEq<BitBox<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialEq<BitSlice<T2, O2>>">PartialEq<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialEq<BitSlice<T2, O2>>">PartialEq<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialEq<BitSlice<T2, O2>>">PartialEq<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialEq<BitVec<T2, O2>>">PartialEq<BitVec<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialEq<BitVec<T2, O2>>">PartialEq<BitVec<T2, O2>></a></li><li><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialEq<BitVec<T2, O2>>">PartialEq<BitVec<T2, O2>></a></li><li><a href="#impl-PartialOrd%3C%26BitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialOrd<&BitSlice<T2, O2>>">PartialOrd<&BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialOrd<&BitSlice<T2, O2>>">PartialOrd<&BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialOrd<&mut BitSlice<T2, O2>>">PartialOrd<&mut BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialOrd<&mut BitSlice<T2, O2>>">PartialOrd<&mut BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3CT,+O%3E" title="PartialOrd<BitArray<A, O>>">PartialOrd<BitArray<A, O>></a></li><li><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialOrd<BitBox<T2, O2>>">PartialOrd<BitBox<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialOrd<BitBox<T2, O2>>">PartialOrd<BitBox<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialOrd<BitBox<T2, O2>>">PartialOrd<BitBox<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialOrd<BitSlice<T2, O2>>">PartialOrd<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialOrd<BitSlice<T2, O2>>">PartialOrd<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialOrd<BitSlice<T2, O2>>">PartialOrd<BitSlice<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" title="PartialOrd<BitVec<T2, O2>>">PartialOrd<BitVec<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" title="PartialOrd<BitVec<T2, O2>>">PartialOrd<BitVec<T2, O2>></a></li><li><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" title="PartialOrd<BitVec<T2, O2>>">PartialOrd<BitVec<T2, O2>></a></li><li><a href="#impl-Pointer-for-BitSlice%3CT,+O%3E" title="Pointer">Pointer</a></li><li><a href="#impl-Read-for-%26BitSlice%3CT,+O%3E" title="Read">Read</a></li><li><a href="#impl-Send-for-BitSlice%3CT,+O%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-BitSlice%3CT,+O%3E" title="Sync">Sync</a></li><li><a href="#impl-ToOwned-for-BitSlice%3CT,+O%3E" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryFrom%3C%26%5BT%5D%3E-for-%26BitSlice%3CT,+O%3E" title="TryFrom<&'a [T]>">TryFrom<&'a [T]></a></li><li><a href="#impl-TryFrom%3C%26mut+%5BT%5D%3E-for-%26mut+BitSlice%3CT,+O%3E" title="TryFrom<&'a mut [T]>">TryFrom<&'a mut [T]></a></li><li><a href="#impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26BitArray%3CA,+O%3E" title="TryFrom<&BitSlice<<A as BitView>::Store, O>>">TryFrom<&BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" title="TryFrom<&BitSlice<<A as BitView>::Store, O>>">TryFrom<&BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-TryFrom%3C%26mut+BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26mut+BitArray%3CA,+O%3E" title="TryFrom<&mut BitSlice<<A as BitView>::Store, O>>">TryFrom<&mut BitSlice<<A as BitView>::Store, O>></a></li><li><a href="#impl-Unpin-for-BitSlice%3CT,+O%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UpperHex-for-BitSlice%3CT,+O%3E" title="UpperHex">UpperHex</a></li><li><a href="#impl-Write-for-%26mut+BitSlice%3CT,+O%3E" title="Write">Write</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Sized-for-BitSlice%3CT,+O%3E" title="!Sized">!Sized</a></li><li><a href="#impl-Freeze-for-BitSlice%3CT,+O%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-BitSlice%3CT,+O%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-BitSlice%3CT,+O%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-Comparable%3CK%3E-for-Q" title="Comparable<K>">Comparable<K></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-Equivalent%3CK%3E-for-Q-1" title="Equivalent<K>">Equivalent<K></a></li><li><a href="#impl-Pipe-for-T" title="Pipe">Pipe</a></li><li><a href="#impl-ToString-for-T" title="ToString">ToString</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In common_<wbr>base::<wbr>bit_<wbr>vec::<wbr>prelude</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"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">common_base</a>::<wbr><a href="../index.html">bit_vec</a>::<wbr><a href="index.html">prelude</a></div><h1>Struct <span class="struct">BitSlice</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code><div class="code-attribute">#[repr(transparent)]</div>pub struct BitSlice<T = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, O = <a class="struct" href="struct.LocalBits.html" title="struct common_base::bit_vec::prelude::LocalBits">Lsb0</a>><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div>{
|
||
_ord: <a class="struct" href="https://doc.rust-lang.org/nightly/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a><O>,
|
||
_typ: <a class="struct" href="https://doc.rust-lang.org/nightly/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>,
|
||
_mem: [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>],
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="bit-addressable-memory"><a class="doc-anchor" href="#bit-addressable-memory">§</a>Bit-Addressable Memory</h2>
|
||
<p>A slice of individual bits, anywhere in memory.</p>
|
||
<p><code>BitSlice<T, O></code> is an unsized region type; you interact with it through
|
||
<code>&BitSlice<T, O></code> and <code>&mut BitSlice<T, O></code> references, which work exactly like
|
||
all other Rust references. As with the standard slice’s relationship to arrays
|
||
and vectors, this is <code>bitvec</code>’s primary working type, but you will probably
|
||
hold it through one of the provided <a href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray"><code>BitArray</code></a>, <a href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox"><code>BitBox</code></a>, or <a href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec"><code>BitVec</code></a>
|
||
containers.</p>
|
||
<p><code>BitSlice</code> is conceptually a <code>[bool]</code> slice, and provides a nearly complete
|
||
mirror of <code>[bool]</code>’s API.</p>
|
||
<p>Every bit-vector crate can give you an opaque type that hides shift/mask
|
||
calculations from you. <code>BitSlice</code> does far more than this: it offers you the
|
||
full Rust guarantees about reference behavior, including lifetime tracking,
|
||
mutability and aliasing awareness, and explicit memory control, <em>as well as</em> the
|
||
full set of tools and APIs available to the standard <code>[bool]</code> slice type.
|
||
<code>BitSlice</code> can arbitrarily split and subslice, just like <code>[bool]</code>. You can write
|
||
a linear consuming function and keep the patterns you already know.</p>
|
||
<p>For example, to trim all the bits off either edge that match a condition, you
|
||
could write</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">fn </span>trim<T: BitStore, O: BitOrder>(
|
||
bits: <span class="kw-2">&</span>BitSlice<T, O>,
|
||
to_trim: bool,
|
||
) -> <span class="kw-2">&</span>BitSlice<T, O> {
|
||
<span class="kw">let </span>stop = |b: bool| b != to_trim;
|
||
<span class="kw">let </span>front = bits.iter()
|
||
.by_vals()
|
||
.position(stop)
|
||
.unwrap_or(<span class="number">0</span>);
|
||
<span class="kw">let </span>back = bits.iter()
|
||
.by_vals()
|
||
.rposition(stop)
|
||
.map_or(<span class="number">0</span>, |p| p + <span class="number">1</span>);
|
||
<span class="kw-2">&</span>bits[front .. back]
|
||
}</code></pre></div>
|
||
<p>to get behavior something like
|
||
<code>trim(&BitSlice[0, 0, 1, 1, 0, 1, 0], false) == &BitSlice[1, 1, 0, 1]</code>.</p>
|
||
<h3 id="documentation"><a class="doc-anchor" href="#documentation">§</a>Documentation</h3>
|
||
<p>All APIs that mirror something in the standard library will have an <code>Original</code>
|
||
section linking to the corresponding item. All APIs that have a different
|
||
signature or behavior than the original will have an <code>API Differences</code> section
|
||
explaining what has changed, and how to adapt your existing code to the change.</p>
|
||
<p>These sections look like this:</p>
|
||
<h3 id="original"><a class="doc-anchor" href="#original">§</a>Original</h3>
|
||
<p><a href="https://doc.rust-lang.org/stable/std/primitive.slice.html"><code>[bool]</code></a></p>
|
||
<h3 id="api-differences"><a class="doc-anchor" href="#api-differences">§</a>API Differences</h3>
|
||
<p>The slice type <code>[bool]</code> has no type parameters. <code>BitSlice<T, O></code> has two: one
|
||
for the integer type used as backing storage, and one for the order of bits
|
||
within that integer type.</p>
|
||
<p><code>&BitSlice<T, O></code> is capable of producing <code>&bool</code> references to read bits out
|
||
of its memory, but is not capable of producing <code>&mut bool</code> references to write
|
||
bits <em>into</em> its memory. Any <code>[bool]</code> API that would produce a <code>&mut bool</code> will
|
||
instead produce a <a href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef"><code>BitRef<Mut, T, O></code></a> proxy reference.</p>
|
||
<h3 id="behavior"><a class="doc-anchor" href="#behavior">§</a>Behavior</h3>
|
||
<p><code>BitSlice</code> is a wrapper over <code>[T]</code>. It describes a region of memory, and must be
|
||
handled indirectly. This is most commonly done through the reference types
|
||
<code>&BitSlice</code> and <code>&mut BitSlice</code>, which borrow memory owned by some other value
|
||
in the program. These buffers can be directly owned by the sibling types
|
||
<a href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox"><code>BitBox</code></a>, which behaves like <a href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box"><code>Box<[T]></code></a>, and <a href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec"><code>BitVec</code></a>,
|
||
which behaves like <a href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec"><code>Vec<T></code></a>. It cannot be used as the type parameter to a
|
||
pointer type such as <code>Box</code>, <code>Rc</code>, <code>Arc</code>, or any other indirection.</p>
|
||
<p>The <code>BitSlice</code> region provides access to each individual bit in the region, as
|
||
if each bit had a memory address that you could use to dereference it. It packs
|
||
each logical bit into exactly one bit of storage memory, just like
|
||
<a href="https://en.cppreference.com/w/cpp/utility/bitset"><code>std::bitset</code></a> and <a href="https://en.cppreference.com/w/cpp/container/vector_bool"><code>std::vector<bool></code></a> in C++.</p>
|
||
<h3 id="type-parameters"><a class="doc-anchor" href="#type-parameters">§</a>Type Parameters</h3>
|
||
<p><code>BitSlice</code> has two type parameters which propagate through nearly every public
|
||
API in the crate. These are very important to its operation, and your choice
|
||
of type arguments informs nearly every part of this library’s behavior.</p>
|
||
<h4 id="t-bitstore"><a class="doc-anchor" href="#t-bitstore">§</a><code>T: BitStore</code></h4>
|
||
<p><a href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore"><code>BitStore</code></a> is the simpler of the two parameters. It refers to the integer type
|
||
used to hold bits. It must be one of the Rust unsigned integer fundamentals:
|
||
<code>u8</code>, <code>u16</code>, <code>u32</code>, <code>usize</code>, and on 64-bit systems only, <code>u64</code>. In addition, it
|
||
can also be an alias-safe wrapper over them (see the <a href="crate::access"><code>access</code></a> module) in
|
||
order to permit bit-slices to share underlying memory without interfering with
|
||
each other.</p>
|
||
<p><code>BitSlice</code> references can only be constructed over the integers, not over their
|
||
aliasing wrappers. <code>BitSlice</code> will only use aliasing types in its <code>T</code> slots when
|
||
you invoke APIs that produce them, such as <a href="struct.BitSlice.html#method.split_at_mut" title="method common_base::bit_vec::prelude::BitSlice::split_at_mut"><code>.split_at_mut()</code></a>.</p>
|
||
<p>The default type argument is <code>usize</code>.</p>
|
||
<p>The argument you choose is used as the basis of a <code>[T]</code> slice, over which the
|
||
<code>BitSlice</code> view is produced. <code>BitSlice<T, _></code> is subject to all of the rules
|
||
about alignment that <code>[T]</code> is. If you are working with in-memory representation
|
||
formats, chances are that you already have a <code>T</code> type with which you’ve been
|
||
working, and should use it here.</p>
|
||
<p>If you are only using this crate to discard the seven wasted bits per <code>bool</code>
|
||
in a collection of <code>bool</code>s, and are not too concerned about the in-memory
|
||
representation, then you should use the default type argument of <code>usize</code>. This
|
||
is because most processors work best when moving an entire <code>usize</code> between
|
||
memory and the processor itself, and using a smaller type may cause it to slow
|
||
down. Additionally, processor instructions are typically optimized for the whole
|
||
register, and the processor might need to do additional clearing work for
|
||
narrower types.</p>
|
||
<h4 id="o-bitorder"><a class="doc-anchor" href="#o-bitorder">§</a><code>O: BitOrder</code></h4>
|
||
<p><a href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder"><code>BitOrder</code></a> is the more complex parameter. It has a default argument which,
|
||
like <code>usize</code>, is a good baseline choice when you do not explicitly need to
|
||
control the representation of bits in memory.</p>
|
||
<p>This parameter determines how <code>bitvec</code> indexes the bits within a single <code>T</code>
|
||
memory element. Computers all agree that in a slice of <code>T</code> elements, the element
|
||
with the lower index has a lower memory address than the element with the higher
|
||
index. But the individual bits within an element do not have addresses, and so
|
||
there is no uniform standard of which bit is the zeroth, which is the first,
|
||
which is the penultimate, and which is the last.</p>
|
||
<p>To make matters even more confusing, there are two predominant ideas of
|
||
in-element ordering that often <em>correlate</em> with the in-element <em>byte</em> ordering
|
||
of integer types, but are in fact wholly unrelated! <code>bitvec</code> provides these two
|
||
main orderings as types for you, and if you need a different one, it also
|
||
provides the tools you need to write your own.</p>
|
||
<h5 id="least-significant-bit-comes-first"><a class="doc-anchor" href="#least-significant-bit-comes-first">§</a>Least Significant Bit Comes First</h5>
|
||
<p>This ordering, named the <a href="struct.LocalBits.html" title="struct common_base::bit_vec::prelude::LocalBits"><code>Lsb0</code></a> type, indexes bits within an element by
|
||
placing the <code>0</code> index at the least significant bit (numeric value <code>1</code>) and the
|
||
final index at the most significant bit (numeric value <a href="https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MIN"><code>T::MIN</code></a> for
|
||
signed integers on most machines).</p>
|
||
<p>For example, this is the ordering used by most C compilers to lay out bit-field
|
||
struct members on little-endian <strong>byte</strong>-ordered machines.</p>
|
||
<h5 id="most-significant-bit-comes-first"><a class="doc-anchor" href="#most-significant-bit-comes-first">§</a>Most Significant Bit Comes First</h5>
|
||
<p>This ordering, named the <a href="struct.Msb0.html" title="struct common_base::bit_vec::prelude::Msb0"><code>Msb0</code></a> type, indexes bits within an element by
|
||
placing the <code>0</code> index at the most significant bit (numeric value
|
||
<a href="https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.MIN"><code>T::MIN</code></a> for most signed integers) and the final index at the least
|
||
significant bit (numeric value <code>1</code>).</p>
|
||
<p>For example, this is the ordering used by the <a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure">TCP wire format</a>, and by
|
||
most C compilers to lay out bit-field struct members on big-endian
|
||
<strong>byte</strong>-ordered machines.</p>
|
||
<h5 id="default-ordering"><a class="doc-anchor" href="#default-ordering">§</a>Default Ordering</h5>
|
||
<p>The default ordering is <a href="struct.LocalBits.html" title="struct common_base::bit_vec::prelude::LocalBits"><code>Lsb0</code></a>, as it typically produces shorter object code
|
||
than <a href="struct.Msb0.html" title="struct common_base::bit_vec::prelude::Msb0"><code>Msb0</code></a> does. If you are implementing a collection, then <code>Lsb0</code> will
|
||
likely give you better performance; if you are implementing a buffer protocol,
|
||
then your choice of ordering is dictated by the protocol definition.</p>
|
||
<h3 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h3>
|
||
<p><code>BitSlice</code> is designed to never introduce new memory unsafety that you did not
|
||
provide yourself, either before or during the use of this crate. However, safety
|
||
bugs have been identified before, and you are welcome to submit any discovered
|
||
flaws as a defect report.</p>
|
||
<p>The <code>&BitSlice</code> reference type uses a private encoding scheme to hold all of the
|
||
information needed in its stack value. This encoding is <strong>not</strong> part of the
|
||
public API of the library, and is not binary-compatible with <code>&[T]</code>.
|
||
Furthermore, in order to satisfy Rust’s requirements about alias conditions,
|
||
<code>BitSlice</code> performs type transformations on the <code>T</code> parameter to ensure that it
|
||
never creates the potential for undefined behavior or data races.</p>
|
||
<p>You must never attempt to type-cast a reference to <code>BitSlice</code> in any way. You
|
||
must not use <a href="https://doc.rust-lang.org/nightly/core/intrinsics/fn.transmute.html" title="fn core::intrinsics::transmute"><code>mem::transmute</code></a> with <code>BitSlice</code> anywhere in its type arguments.
|
||
You must not use <code>as</code>-casting to convert between <code>*BitSlice</code> and any other type.
|
||
You must not attempt to modify the binary representation of a <code>&BitSlice</code>
|
||
reference value. These actions will all lead to runtime memory unsafety, are
|
||
(hopefully) likely to induce a program crash, and may possibly cause undefined
|
||
behavior at compile-time.</p>
|
||
<p>Everything in the <code>BitSlice</code> public API, even the <code>unsafe</code> parts, are guaranteed
|
||
to have no more unsafety than their equivalent items in the standard library.
|
||
All <code>unsafe</code> APIs will have documentation explicitly detailing what the API
|
||
requires you to uphold in order for it to function safely and correctly. All
|
||
safe APIs will do so themselves.</p>
|
||
<h3 id="performance"><a class="doc-anchor" href="#performance">§</a>Performance</h3>
|
||
<p>Like the standard library’s <code>[T]</code> slice, <code>BitSlice</code> is designed to be very easy
|
||
to use safely, while supporting <code>unsafe</code> usage when necessary. Rust has a
|
||
powerful optimizing engine, and <code>BitSlice</code> will frequently be compiled to have
|
||
zero runtime cost. Where it is slower, it will not be significantly slower than
|
||
a manual replacement.</p>
|
||
<p>As the machine instructions operate on registers rather than bits, your choice
|
||
of <a href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore"><code>T: BitStore</code></a> type parameter can influence your bits-slice’s performance.
|
||
Using larger register types means that bit-slices can gallop over
|
||
completely-used interior elements faster, while narrower register types permit
|
||
more graceful handling of subslicing and aliased splits.</p>
|
||
<h3 id="construction"><a class="doc-anchor" href="#construction">§</a>Construction</h3>
|
||
<p><code>BitSlice</code> views of memory can be constructed over borrowed data in a number of
|
||
ways. As this is a reference-only type, it can only ever be built by borrowing
|
||
an existing memory buffer and taking temporary control of your program’s view of
|
||
the region.</p>
|
||
<h4 id="macro-constructor"><a class="doc-anchor" href="#macro-constructor">§</a>Macro Constructor</h4>
|
||
<p><code>BitSlice</code> buffers can be constructed at compile-time through the <a href="macro.bits.html" title="macro common_base::bit_vec::prelude::bits"><code>bits!</code></a>
|
||
macro. This macro accepts a superset of the <a href="https://doc.rust-lang.org/nightly/alloc/macro.vec.html" title="macro alloc::vec"><code>vec!</code></a> arguments, and creates an
|
||
appropriate buffer in the local scope. The macro expands to a borrowed
|
||
<a href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray"><code>BitArray</code></a> temporary, which will live for the duration of the bound name.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>immut = <span class="macro">bits!</span>[u8, Lsb0; <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>mutable: <span class="kw-2">&mut </span>BitSlice<<span class="kw">_</span>, <span class="kw">_</span>> = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">8</span>];
|
||
|
||
<span class="macro">assert_ne!</span>(immut, mutable);
|
||
mutable.clone_from_bitslice(immut);
|
||
<span class="macro">assert_eq!</span>(immut, mutable);</code></pre></div><h4 id="borrowing-constructors"><a class="doc-anchor" href="#borrowing-constructors">§</a>Borrowing Constructors</h4>
|
||
<p>You may borrow existing elements or slices with the following functions:</p>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.from_element" title="associated function common_base::bit_vec::prelude::BitSlice::from_element"><code>from_element</code></a> and <a href="struct.BitSlice.html#method.from_element_mut" title="associated function common_base::bit_vec::prelude::BitSlice::from_element_mut"><code>from_element_mut</code></a>,</li>
|
||
<li><a href="struct.BitSlice.html#method.from_slice" title="associated function common_base::bit_vec::prelude::BitSlice::from_slice"><code>from_slice</code></a> and <a href="struct.BitSlice.html#method.from_slice_mut" title="associated function common_base::bit_vec::prelude::BitSlice::from_slice_mut"><code>from_slice_mut</code></a>,</li>
|
||
<li><a href="struct.BitSlice.html#method.try_from_slice" title="associated function common_base::bit_vec::prelude::BitSlice::try_from_slice"><code>try_from_slice</code></a> and <a href="struct.BitSlice.html#method.try_from_slice_mut" title="associated function common_base::bit_vec::prelude::BitSlice::try_from_slice_mut"><code>try_from_slice_mut</code></a></li>
|
||
</ul>
|
||
<p>These take references to existing memory and construct <code>BitSlice</code> references
|
||
from them. These are the most basic ways to borrow memory and view it as bits;
|
||
however, you should prefer the <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait methods instead.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [<span class="number">0u16</span>; <span class="number">3</span>];
|
||
<span class="kw">let </span>local_borrow = BitSlice::<<span class="kw">_</span>, Lsb0>::from_slice(<span class="kw-2">&</span>data);
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = [<span class="number">0u8</span>; <span class="number">5</span>];
|
||
<span class="kw">let </span>local_mut = BitSlice::<<span class="kw">_</span>, Lsb0>::from_slice_mut(<span class="kw-2">&mut </span>data);</code></pre></div><h4 id="trait-method-constructors"><a class="doc-anchor" href="#trait-method-constructors">§</a>Trait Method Constructors</h4>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait implements <a href="trait._.html#tymethod.view_bits" title="method common_base::bit_vec::prelude::_::view_bits"><code>.view_bits::<O>()</code></a> and
|
||
<a href="trait._.html#tymethod.view_bits_mut" title="method common_base::bit_vec::prelude::_::view_bits_mut"><code>.view_bits_mut::<O>()</code></a> methods on elements, arrays, and slices. This trait,
|
||
imported in the crate prelude, is <em>probably</em> the easiest way for you to borrow
|
||
memory as bits.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [<span class="number">0u32</span>; <span class="number">5</span>];
|
||
<span class="kw">let </span>trait_view = data.view_bits::<Lsb0>();
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = <span class="number">0usize</span>;
|
||
<span class="kw">let </span>trait_mut = data.view_bits_mut::<Msb0>();</code></pre></div><h4 id="owned-bit-slices"><a class="doc-anchor" href="#owned-bit-slices">§</a>Owned Bit Slices</h4>
|
||
<p>If you wish to take ownership of a memory region and enforce that it is always
|
||
viewed as a <code>BitSlice</code> by default, you can use one of the <a href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray"><code>BitArray</code></a>,
|
||
<a href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox"><code>BitBox</code></a>, or <a href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec"><code>BitVec</code></a> types, rather than pairing ordinary buffer types with
|
||
the borrowing constructors.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>slice = <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">27</span>];
|
||
<span class="kw">let </span>array = <span class="macro">bitarr!</span>[u8, LocalBits; <span class="number">0</span>; <span class="number">10</span>];
|
||
<span class="kw">let </span>boxed = <span class="macro">bitbox!</span>[<span class="number">0</span>; <span class="number">10</span>];
|
||
<span class="kw">let </span>vec = <span class="macro">bitvec!</span>[<span class="number">0</span>; <span class="number">20</span>];
|
||
|
||
<span class="comment">// arrays always round up
|
||
</span><span class="macro">assert_eq!</span>(array.as_bitslice(), slice[.. <span class="number">16</span>]);
|
||
<span class="macro">assert_eq!</span>(boxed.as_bitslice(), slice[.. <span class="number">10</span>]);
|
||
<span class="macro">assert_eq!</span>(vec.as_bitslice(), slice[.. <span class="number">20</span>]);</code></pre></div><h3 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h3>
|
||
<p><code>BitSlice</code> implements the full standard-library <code>[bool]</code> API. The documentation
|
||
for these API surfaces is intentionally sparse, and forwards to the standard
|
||
library rather than try to replicate it.</p>
|
||
<p><code>BitSlice</code> also has a great deal of novel API surfaces. These are broken into
|
||
separate <code>impl</code> blocks below. A short summary:</p>
|
||
<ul>
|
||
<li>Since there is no <code>BitSlice</code> literal, the constructor functions <code>::empty()</code>,
|
||
<code>::from_element()</code>, <code>::from_slice()</code>, and <code>::try_from_slice()</code>, and their
|
||
<code>_mut</code> counterparts, create bit-slices as needed.</li>
|
||
<li>Since <code>bits[idx] = value</code> does not exist, you can use <code>.set()</code> or <code>.replace()</code>
|
||
(as well as their <code>_unchecked</code> and <code>_aliased</code> counterparts) to write into a
|
||
bit-slice.</li>
|
||
<li>Raw memory can be inspected with <code>.domain()</code> and <code>.domain_mut()</code>, and a
|
||
bit-slice can be split on aliasing lines with <code>.bit_domain()</code> and
|
||
<code>.bit_domain_mut()</code>.</li>
|
||
<li>The population can be queried for which indices have <code>0</code> or <code>1</code> bits by
|
||
iterating across all such indices, counting them, or counting leading or
|
||
trailing blocks. Additionally, <code>.any()</code>, <code>.all()</code>, <code>.not_any()</code>, <code>.not_all()</code>,
|
||
and <code>.some()</code> test whether bit-slices satisfy aggregate Boolean qualities.</li>
|
||
<li>Buffer contents can be relocated internally by shifting or rotating to the
|
||
left or right.</li>
|
||
</ul>
|
||
<h3 id="trait-implementations-1"><a class="doc-anchor" href="#trait-implementations-1">§</a>Trait Implementations</h3>
|
||
<p><code>BitSlice</code> adds trait implementations that <code>[bool]</code> and <code>[T]</code> do not necessarily
|
||
have, including numeric formatting and Boolean arithmetic operators.
|
||
Additionally, the <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitField</code></a> trait allows bit-slices to act as a buffer for
|
||
wide-value storage.</p>
|
||
</div></details><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield._ord" class="structfield section-header"><a href="#structfield._ord" class="anchor field">§</a><code>_ord: <a class="struct" href="https://doc.rust-lang.org/nightly/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a><O></code></span><span id="structfield._typ" class="structfield section-header"><a href="#structfield._typ" class="anchor field">§</a><code>_typ: <a class="struct" href="https://doc.rust-lang.org/nightly/core/marker/struct.PhantomData.html" title="struct core::marker::PhantomData">PhantomData</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>></code></span><span id="structfield._mem" class="structfield section-header"><a href="#structfield._mem" class="anchor field">§</a><code>_mem: [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>]</code></span><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-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Port of the <code>[T]</code> inherent API.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><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/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Gets the number of bits in the bit-slice.</p>
|
||
<h6 id="original-1"><a class="doc-anchor" href="#original-1">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.len"><code>slice::len</code></a></p>
|
||
<h6 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].len(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">10</span>].len(), <span class="number">10</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><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/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if the bit-slice is empty (length zero).</p>
|
||
<h6 id="original-2"><a class="doc-anchor" href="#original-2">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.is_empty"><code>slice::is_empty</code></a></p>
|
||
<h6 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].is_empty());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">10</span>].is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first" class="method"><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Const, T, O>></h4></section></summary><div class="docblock"><p>Gets a reference to the first bit of the bit-slice, or <code>None</code> if it is
|
||
empty.</p>
|
||
<h6 id="original-3"><a class="doc-anchor" href="#original-3">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.first"><code>slice::first</code></a></p>
|
||
<h6 id="api-differences-1"><a class="doc-anchor" href="#api-differences-1">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>.</p>
|
||
<h6 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits.first().as_deref(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="bool-val">true</span>));
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].first().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first_mut" class="method"><h4 class="code-header">pub fn <a href="#method.first_mut" class="fn">first_mut</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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Mut, T, O>></h4></section></summary><div class="docblock"><p>Gets a mutable reference to the first bit of the bit-slice, or <code>None</code> if
|
||
it is empty.</p>
|
||
<h6 id="original-4"><a class="doc-anchor" href="#original-4">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.first_mut"><code>slice::first_mut</code></a></p>
|
||
<h6 id="api-differences-2"><a class="doc-anchor" href="#api-differences-2">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>. This must be bound as <code>mut</code> in order to write
|
||
through it.</p>
|
||
<h6 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>first) = bits.first_mut() {
|
||
<span class="kw-2">*</span>first = <span class="bool-val">true</span>;
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]);
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="kw-2">mut</span>].first_mut().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first" class="method"><h4 class="code-header">pub fn <a href="#method.split_first" class="fn">split_first</a>(&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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Const, T, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)></h4></section></summary><div class="docblock"><p>Splits the bit-slice into a reference to its first bit, and the rest of
|
||
the bit-slice. Returns <code>None</code> when empty.</p>
|
||
<h6 id="original-5"><a class="doc-anchor" href="#original-5">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_first"><code>slice::split_first</code></a></p>
|
||
<h6 id="api-differences-3"><a class="doc-anchor" href="#api-differences-3">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>.</p>
|
||
<h6 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="kw">let </span>(first, rest) = bits.split_first().unwrap();
|
||
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&</span><span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(rest, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first_mut" class="method"><h4 class="code-header">pub fn <a href="#method.split_first_mut" class="fn">split_first_mut</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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Mut, <T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>)></h4></section></summary><div class="docblock"><p>Splits the bit-slice into mutable references of its first bit, and the
|
||
rest of the bit-slice. Returns <code>None</code> when empty.</p>
|
||
<h6 id="original-6"><a class="doc-anchor" href="#original-6">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_first_mut"><code>slice::split_first_mut</code></a></p>
|
||
<h6 id="api-differences-4"><a class="doc-anchor" href="#api-differences-4">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>. This must be bound as <code>mut</code> in order to write
|
||
through it.</p>
|
||
<h6 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="kw-2">mut </span>first, rest)) = bits.split_first_mut() {
|
||
<span class="kw-2">*</span>first = <span class="bool-val">true</span>;
|
||
<span class="macro">assert_eq!</span>(rest, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_last" class="method"><h4 class="code-header">pub fn <a href="#method.split_last" class="fn">split_last</a>(&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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Const, T, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)></h4></section></summary><div class="docblock"><p>Splits the bit-slice into a reference to its last bit, and the rest of
|
||
the bit-slice. Returns <code>None</code> when empty.</p>
|
||
<h6 id="original-7"><a class="doc-anchor" href="#original-7">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_last"><code>slice::split_last</code></a></p>
|
||
<h6 id="api-differences-5"><a class="doc-anchor" href="#api-differences-5">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>.</p>
|
||
<h6 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>(last, rest) = bits.split_last().unwrap();
|
||
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&</span><span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(rest, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_last_mut" class="method"><h4 class="code-header">pub fn <a href="#method.split_last_mut" class="fn">split_last_mut</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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Mut, <T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>)></h4></section></summary><div class="docblock"><p>Splits the bit-slice into mutable references to its last bit, and the
|
||
rest of the bit-slice. Returns <code>None</code> when empty.</p>
|
||
<h6 id="original-8"><a class="doc-anchor" href="#original-8">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_last_mut"><code>slice::split_last_mut</code></a></p>
|
||
<h6 id="api-differences-6"><a class="doc-anchor" href="#api-differences-6">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>. This must be bound as <code>mut</code> in order to write
|
||
through it.</p>
|
||
<h6 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((<span class="kw-2">mut </span>last, rest)) = bits.split_last_mut() {
|
||
<span class="kw-2">*</span>last = <span class="bool-val">true</span>;
|
||
<span class="macro">assert_eq!</span>(rest, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Const, T, O>></h4></section></summary><div class="docblock"><p>Gets a reference to the last bit of the bit-slice, or <code>None</code> if it is
|
||
empty.</p>
|
||
<h6 id="original-9"><a class="doc-anchor" href="#original-9">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.last"><code>slice::last</code></a></p>
|
||
<h6 id="api-differences-7"><a class="doc-anchor" href="#api-differences-7">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>.</p>
|
||
<h6 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="macro">assert_eq!</span>(bits.last().as_deref(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="bool-val">true</span>));
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].last().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last_mut" class="method"><h4 class="code-header">pub fn <a href="#method.last_mut" class="fn">last_mut</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="struct" href="struct.BitRef.html" title="struct common_base::bit_vec::prelude::BitRef">BitRef</a><'_, Mut, T, O>></h4></section></summary><div class="docblock"><p>Gets a mutable reference to the last bit of the bit-slice, or <code>None</code> if
|
||
it is empty.</p>
|
||
<h6 id="original-10"><a class="doc-anchor" href="#original-10">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.last_mut"><code>slice::last_mut</code></a></p>
|
||
<h6 id="api-differences-8"><a class="doc-anchor" href="#api-differences-8">§</a>API Differences</h6>
|
||
<p><code>bitvec</code> uses a custom structure for both read-only and mutable
|
||
references to <code>bool</code>. This must be bound as <code>mut</code> in order to write
|
||
through it.</p>
|
||
<h6 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">3</span>];
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>last) = bits.last_mut() {
|
||
<span class="kw-2">*</span>last = <span class="bool-val">true</span>;
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="kw-2">mut</span>].last_mut().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a><'a, I>(
|
||
&'a self,
|
||
index: I,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<I as BitSliceIndex<'a, T, O>>::Immut><div class="where">where
|
||
I: BitSliceIndex<'a, T, O>,</div></h4></section></summary><div class="docblock"><p>Gets a reference to a single bit or a subsection of the bit-slice,
|
||
depending on the type of <code>index</code>.</p>
|
||
<ul>
|
||
<li>If given a <code>usize</code>, this produces a reference structure to the <code>bool</code>
|
||
at the position.</li>
|
||
<li>If given any form of range, this produces a smaller bit-slice.</li>
|
||
</ul>
|
||
<p>This returns <code>None</code> if the <code>index</code> departs the bounds of <code>self</code>.</p>
|
||
<h6 id="original-11"><a class="doc-anchor" href="#original-11">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.get"><code>slice::get</code></a></p>
|
||
<h6 id="api-differences-9"><a class="doc-anchor" href="#api-differences-9">§</a>API Differences</h6>
|
||
<p><code>BitSliceIndex</code> uses discrete types for immutable and mutable
|
||
references, rather than a single referent type.</p>
|
||
<h6 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits.get(<span class="number">1</span>).as_deref(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="bool-val">true</span>));
|
||
<span class="macro">assert_eq!</span>(bits.get(<span class="number">0 </span>.. <span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert!</span>(bits.get(<span class="number">3</span>).is_none());
|
||
<span class="macro">assert!</span>(bits.get(<span class="number">0 </span>.. <span class="number">4</span>).is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a><'a, I>(
|
||
&'a mut self,
|
||
index: I,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<I as BitSliceIndex<'a, T, O>>::Mut><div class="where">where
|
||
I: BitSliceIndex<'a, T, O>,</div></h4></section></summary><div class="docblock"><p>Gets a mutable reference to a single bit or a subsection of the
|
||
bit-slice, depending on the type of <code>index</code>.</p>
|
||
<ul>
|
||
<li>If given a <code>usize</code>, this produces a reference structure to the <code>bool</code>
|
||
at the position.</li>
|
||
<li>If given any form of range, this produces a smaller bit-slice.</li>
|
||
</ul>
|
||
<p>This returns <code>None</code> if the <code>index</code> departs the bounds of <code>self</code>.</p>
|
||
<h6 id="original-12"><a class="doc-anchor" href="#original-12">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.get_mut"><code>slice::get_mut</code></a></p>
|
||
<h6 id="api-differences-10"><a class="doc-anchor" href="#api-differences-10">§</a>API Differences</h6>
|
||
<p><code>BitSliceIndex</code> uses discrete types for immutable and mutable
|
||
references, rather than a single referent type.</p>
|
||
<h6 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">3</span>];
|
||
|
||
<span class="kw-2">*</span>bits.get_mut(<span class="number">0</span>).unwrap() = <span class="bool-val">true</span>;
|
||
bits.get_mut(<span class="number">1 </span>..).unwrap().fill(<span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>; <span class="number">3</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fn">get_unchecked</a><'a, I>(
|
||
&'a self,
|
||
index: I,
|
||
) -> <I as BitSliceIndex<'a, T, O>>::Immut<div class="where">where
|
||
I: BitSliceIndex<'a, T, O>,</div></h4></section></summary><div class="docblock"><p>Gets a reference to a single bit or to a subsection of the bit-slice,
|
||
without bounds checking.</p>
|
||
<p>This has the same arguments and behavior as <a href="struct.BitSlice.html#method.get" title="method common_base::bit_vec::prelude::BitSlice::get"><code>.get()</code></a>, except that it
|
||
does not check that <code>index</code> is in bounds.</p>
|
||
<h6 id="original-13"><a class="doc-anchor" href="#original-13">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.get_unchecked"><code>slice::get_unchecked</code></a></p>
|
||
<h6 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h6>
|
||
<p>You must ensure that <code>index</code> is within bounds (within the range <code>0 .. self.len()</code>), or this method will introduce memory safety and/or
|
||
undefined behavior.</p>
|
||
<p>It is library-level undefined behavior to index beyond the length of any
|
||
bit-slice, even if you <strong>know</strong> that the offset remains within an
|
||
allocation as measured by Rust or LLVM.</p>
|
||
<h6 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = <span class="number">0b0001_0010u8</span>;
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Lsb0>()[.. <span class="number">3</span>];
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="macro">assert!</span>(bits.get_unchecked(<span class="number">1</span>));
|
||
<span class="macro">assert!</span>(bits.get_unchecked(<span class="number">4</span>));
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked_mut" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked_mut" class="fn">get_unchecked_mut</a><'a, I>(
|
||
&'a mut self,
|
||
index: I,
|
||
) -> <I as BitSliceIndex<'a, T, O>>::Mut<div class="where">where
|
||
I: BitSliceIndex<'a, T, O>,</div></h4></section></summary><div class="docblock"><p>Gets a mutable reference to a single bit or a subsection of the
|
||
bit-slice, depending on the type of <code>index</code>.</p>
|
||
<p>This has the same arguments and behavior as <a href="struct.BitSlice.html#method.get_mut" title="method common_base::bit_vec::prelude::BitSlice::get_mut"><code>.get_mut()</code></a>, except that
|
||
it does not check that <code>index</code> is in bounds.</p>
|
||
<h6 id="original-14"><a class="doc-anchor" href="#original-14">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.get_unchecked_mut"><code>slice::get_unchecked_mut</code></a></p>
|
||
<h6 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h6>
|
||
<p>You must ensure that <code>index</code> is within bounds (within the range <code>0 .. self.len()</code>), or this method will introduce memory safety and/or
|
||
undefined behavior.</p>
|
||
<p>It is library-level undefined behavior to index beyond the length of any
|
||
bit-slice, even if you <strong>know</strong> that the offset remains within an
|
||
allocation as measured by Rust or LLVM.</p>
|
||
<h6 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = <span class="number">0u8</span>;
|
||
<span class="kw">let </span>bits = <span class="kw-2">&mut </span>data.view_bits_mut::<Lsb0>()[.. <span class="number">3</span>];
|
||
|
||
<span class="kw">unsafe </span>{
|
||
bits.get_unchecked_mut(<span class="number">1</span>).commit(<span class="bool-val">true</span>);
|
||
bits.get_unchecked_mut(<span class="number">4 </span>.. <span class="number">6</span>).fill(<span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(data, <span class="number">0b0011_0010</span>);</code></pre></div></div></details><section id="method.as_ptr" class="method"><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&self) -> <a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Const, T, O></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.as_bitptr()</code> instead</span></div></span><section id="method.as_mut_ptr" class="method"><h4 class="code-header">pub fn <a href="#method.as_mut_ptr" class="fn">as_mut_ptr</a>(&mut self) -> <a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Mut, T, O></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.as_mut_bitptr()</code> instead</span></div></span><details class="toggle method-toggle" open><summary><section id="method.as_ptr_range" class="method"><h4 class="code-header">pub fn <a href="#method.as_ptr_range" class="fn">as_ptr_range</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Const, T, O>></h4></section></summary><div class="docblock"><p>Produces a range of bit-pointers to each bit in the bit-slice.</p>
|
||
<p>This is a standard-library range, which has no real functionality for
|
||
pointer types. You should prefer <a href="struct.BitSlice.html#method.as_bitptr_range" title="method common_base::bit_vec::prelude::BitSlice::as_bitptr_range"><code>.as_bitptr_range()</code></a> instead, as it
|
||
produces a custom structure that provides expected ranging
|
||
functionality.</p>
|
||
<h6 id="original-15"><a class="doc-anchor" href="#original-15">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range"><code>slice::as_ptr_range</code></a></p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_ptr_range" class="method"><h4 class="code-header">pub fn <a href="#method.as_mut_ptr_range" class="fn">as_mut_ptr_range</a>(&mut self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Mut, T, O>></h4></section></summary><div class="docblock"><p>Produces a range of mutable bit-pointers to each bit in the bit-slice.</p>
|
||
<p>This is a standard-library range, which has no real functionality for
|
||
pointer types. You should prefer <a href="struct.BitSlice.html#method.as_mut_bitptr_range" title="method common_base::bit_vec::prelude::BitSlice::as_mut_bitptr_range"><code>.as_mut_bitptr_range()</code></a> instead, as
|
||
it produces a custom structure that provides expected ranging
|
||
functionality.</p>
|
||
<h6 id="original-16"><a class="doc-anchor" href="#original-16">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range"><code>slice::as_mut_ptr_range</code></a></p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.swap" class="method"><h4 class="code-header">pub fn <a href="#method.swap" class="fn">swap</a>(&mut self, a: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Exchanges the bit values at two indices.</p>
|
||
<h6 id="original-17"><a class="doc-anchor" href="#original-17">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.swap"><code>slice::swap</code></a></p>
|
||
<h6 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h6>
|
||
<p>This panics if either <code>a</code> or <code>b</code> are out of bounds.</p>
|
||
<h6 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">1</span>];
|
||
bits.swap(<span class="number">0</span>, <span class="number">1</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reverse" class="method"><h4 class="code-header">pub fn <a href="#method.reverse" class="fn">reverse</a>(&mut self)</h4></section></summary><div class="docblock"><p>Reverses the order of bits in a bit-slice.</p>
|
||
<h6 id="original-18"><a class="doc-anchor" href="#original-18">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.reverse"><code>slice::reverse</code></a></p>
|
||
<h6 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
bits.reverse();
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&self) -> Iter<'_, T, O></h4></section></summary><div class="docblock"><p>Produces an iterator over each bit in the bit-slice.</p>
|
||
<h6 id="original-19"><a class="doc-anchor" href="#original-19">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.iter"><code>slice::iter</code></a></p>
|
||
<h6 id="api-differences-11"><a class="doc-anchor" href="#api-differences-11">§</a>API Differences</h6>
|
||
<p>This iterator yields proxy-reference structures, not <code>&bool</code>. It can be
|
||
adapted to yield <code>&bool</code> with the <a href="crate::slice::Iter::by_refs"><code>.by_refs()</code></a> method, or <code>bool</code> with
|
||
<a href="crate::slice::Iter::by_vals"><code>.by_vals()</code></a>.</p>
|
||
<p>This iterator, and its adapters, are fast. Do not try to be more clever
|
||
than them by abusing <code>.as_bitptr_range()</code>.</p>
|
||
<h6 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.iter();
|
||
|
||
<span class="macro">assert!</span>(!iter.next().unwrap());
|
||
<span class="macro">assert!</span>( iter.next().unwrap());
|
||
<span class="macro">assert!</span>( iter.next_back().unwrap());
|
||
<span class="macro">assert!</span>(!iter.next_back().unwrap());
|
||
<span class="macro">assert!</span>( iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter_mut" class="method"><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fn">iter_mut</a>(&mut self) -> IterMut<'_, T, O></h4></section></summary><div class="docblock"><p>Produces a mutable iterator over each bit in the bit-slice.</p>
|
||
<h6 id="original-20"><a class="doc-anchor" href="#original-20">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.iter_mut"><code>slice::iter_mut</code></a></p>
|
||
<h6 id="api-differences-12"><a class="doc-anchor" href="#api-differences-12">§</a>API Differences</h6>
|
||
<p>This iterator yields proxy-reference structures, not <code>&mut bool</code>. In
|
||
addition, it marks each proxy as alias-tainted.</p>
|
||
<p>If you are using this in an ordinary loop and <strong>not</strong> keeping multiple
|
||
yielded proxy-references alive at the same scope, you may use the
|
||
<a href="crate::slice::IterMut::remove_alias"><code>.remove_alias()</code></a> adapter to undo the alias marking.</p>
|
||
<p>This iterator is fast. Do not try to be more clever than it by abusing
|
||
<code>.as_mut_bitptr_range()</code>.</p>
|
||
<h6 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">4</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.iter_mut();
|
||
|
||
iter.nth(<span class="number">1</span>).unwrap().commit(<span class="bool-val">true</span>); <span class="comment">// index 1
|
||
</span>iter.next_back().unwrap().commit(<span class="bool-val">true</span>); <span class="comment">// index 3
|
||
|
||
</span><span class="macro">assert!</span>(iter.next().is_some()); <span class="comment">// index 2
|
||
</span><span class="macro">assert!</span>(iter.next().is_none()); <span class="comment">// complete
|
||
</span><span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.windows" class="method"><h4 class="code-header">pub fn <a href="#method.windows" class="fn">windows</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Windows<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over consecutive windowing subslices in a bit-slice.</p>
|
||
<p>Windows are overlapping views of the bit-slice. Each window advances one
|
||
bit from the previous, so in a bit-slice <code>[A, B, C, D, E]</code>, calling
|
||
<code>.windows(3)</code> will yield <code>[A, B, C]</code>, <code>[B, C, D]</code>, and <code>[C, D, E]</code>.</p>
|
||
<h6 id="original-21"><a class="doc-anchor" href="#original-21">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.windows"><code>slice::windows</code></a></p>
|
||
<h6 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h6>
|
||
<p>This panics if <code>size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.windows(<span class="number">3</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks" class="method"><h4 class="code-header">pub fn <a href="#method.chunks" class="fn">chunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Chunks<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping subslices of a bit-slice.</p>
|
||
<p>Unlike <code>.windows()</code>, the subslices this yields do not overlap with each
|
||
other. If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the
|
||
last chunk yielded will be shorter.</p>
|
||
<h6 id="original-22"><a class="doc-anchor" href="#original-22">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.chunks"><code>slice::chunks</code></a></p>
|
||
<h6 id="sibling-methods"><a class="doc-anchor" href="#sibling-methods">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.chunks_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_mut"><code>.chunks_mut()</code></a> has the same division logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact"><code>.chunks_exact()</code></a> does not yield the final chunk if it is shorter
|
||
than <code>chunk_size</code>.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks" title="method common_base::bit_vec::prelude::BitSlice::rchunks"><code>.rchunks()</code></a> iterates from the back of the bit-slice to the front,
|
||
with the final, possibly-shorter, segment at the front edge.</li>
|
||
</ul>
|
||
<h6 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.chunks(<span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">1</span>]));
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_mut" class="method"><h4 class="code-header">pub fn <a href="#method.chunks_mut" class="fn">chunks_mut</a>(&mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> ChunksMut<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping mutable subslices of a bit-slice.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::ChunksMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-23"><a class="doc-anchor" href="#original-23">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_mut"><code>slice::chunks_mut</code></a></p>
|
||
<h6 id="sibling-methods-1"><a class="doc-anchor" href="#sibling-methods-1">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.chunks" title="method common_base::bit_vec::prelude::BitSlice::chunks"><code>.chunks()</code></a> has the same division logic, but each yielded bit-slice
|
||
is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact_mut"><code>.chunks_exact_mut()</code></a> does not yield the final chunk if it is
|
||
shorter than <code>chunk_size</code>.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_mut"><code>.rchunks_mut()</code></a> iterates from the back of the bit-slice to the
|
||
front, with the final, possibly-shorter, segment at the front edge.</li>
|
||
</ul>
|
||
<h6 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">5</span>];
|
||
|
||
<span class="kw">for </span>(idx, chunk) <span class="kw">in unsafe </span>{
|
||
bits.chunks_mut(<span class="number">2</span>).remove_alias()
|
||
}.enumerate() {
|
||
chunk.store(idx + <span class="number">1</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="comment">// ^^^^ ^^^^ ^</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_exact" class="method"><h4 class="code-header">pub fn <a href="#method.chunks_exact" class="fn">chunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> ChunksExact<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping subslices of a bit-slice.</p>
|
||
<p>If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the last
|
||
few bits are not yielded by the iterator at all. They can be accessed
|
||
with the <a href="crate::slice::ChunksExact::remainder"><code>.remainder()</code></a> method if the iterator is bound to a name.</p>
|
||
<h6 id="original-24"><a class="doc-anchor" href="#original-24">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact"><code>slice::chunks_exact</code></a></p>
|
||
<h6 id="sibling-methods-2"><a class="doc-anchor" href="#sibling-methods-2">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.chunks" title="method common_base::bit_vec::prelude::BitSlice::chunks"><code>.chunks()</code></a> yields any leftover bits at the end as a shorter chunk
|
||
during iteration.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact_mut"><code>.chunks_exact_mut()</code></a> has the same division logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact"><code>.rchunks_exact()</code></a> iterates from the back of the bit-slice to the
|
||
front, with the unyielded remainder segment at the front edge.</li>
|
||
</ul>
|
||
<h6 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.chunks_exact(<span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert!</span>(iter.next().is_none());
|
||
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="macro">bits!</span>[<span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_exact_mut" class="method"><h4 class="code-header">pub fn <a href="#method.chunks_exact_mut" class="fn">chunks_exact_mut</a>(
|
||
&mut self,
|
||
chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||
) -> ChunksExactMut<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping mutable subslices of a bit-slice.</p>
|
||
<p>If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the last
|
||
few bits are not yielded by the iterator at all. They can be accessed
|
||
with the <a href="crate::slice::ChunksExactMut::into_remainder"><code>.into_remainder()</code></a> method if the iterator is bound to a
|
||
name.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::ChunksExactMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-25"><a class="doc-anchor" href="#original-25">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact_mut"><code>slice::chunks_exact_mut</code></a></p>
|
||
<h6 id="sibling-methods-3"><a class="doc-anchor" href="#sibling-methods-3">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.chunks_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_mut"><code>.chunks_mut()</code></a> yields any leftover bits at the end as a shorter
|
||
chunk during iteration.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact"><code>.chunks_exact()</code></a> has the same division logic, but each yielded
|
||
bit-slice is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact_mut"><code>.rchunks_exact_mut()</code></a> iterates from the back of the bit-slice
|
||
forwards, with the unyielded remainder segment at the front edge.</li>
|
||
</ul>
|
||
<h6 id="panics-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">5</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.chunks_exact_mut(<span class="number">2</span>);
|
||
|
||
<span class="kw">for </span>(idx, chunk) <span class="kw">in </span>iter.by_ref().enumerate() {
|
||
chunk.store(idx + <span class="number">1</span>);
|
||
}
|
||
iter.into_remainder().store(<span class="number">1u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="comment">// remainder ^</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks" class="method"><h4 class="code-header">pub fn <a href="#method.rchunks" class="fn">rchunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> RChunks<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping subslices of a bit-slice, from the back
|
||
edge.</p>
|
||
<p>Unlike <code>.chunks()</code>, this aligns its chunks to the back edge of <code>self</code>.
|
||
If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the
|
||
leftover partial chunk is <code>self[0 .. len % chunk_size]</code>.</p>
|
||
<h6 id="original-26"><a class="doc-anchor" href="#original-26">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks"><code>slice::rchunks</code></a></p>
|
||
<h6 id="sibling-methods-4"><a class="doc-anchor" href="#sibling-methods-4">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_mut"><code>.rchunks_mut()</code></a> has the same division logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact"><code>.rchunks_exact()</code></a> does not yield the final chunk if it is shorter
|
||
than <code>chunk_size</code>.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks" title="method common_base::bit_vec::prelude::BitSlice::chunks"><code>.chunks()</code></a> iterates from the front of the bit-slice to the back,
|
||
with the final, possibly-shorter, segment at the back edge.</li>
|
||
</ul>
|
||
<h6 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rchunks(<span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>]));
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_mut" class="method"><h4 class="code-header">pub fn <a href="#method.rchunks_mut" class="fn">rchunks_mut</a>(&mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> RChunksMut<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping mutable subslices of a bit-slice, from the
|
||
back edge.</p>
|
||
<p>Unlike <code>.chunks_mut()</code>, this aligns its chunks to the back edge of
|
||
<code>self</code>. If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then
|
||
the leftover partial chunk is <code>self[0 .. len % chunk_size]</code>.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded values for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::RChunksMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-27"><a class="doc-anchor" href="#original-27">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_mut"><code>slice::rchunks_mut</code></a></p>
|
||
<h6 id="sibling-methods-5"><a class="doc-anchor" href="#sibling-methods-5">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rchunks" title="method common_base::bit_vec::prelude::BitSlice::rchunks"><code>.rchunks()</code></a> has the same division logic, but each yielded bit-slice
|
||
is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact_mut"><code>.rchunks_exact_mut()</code></a> does not yield the final chunk if it is
|
||
shorter than <code>chunk_size</code>.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_mut"><code>.chunks_mut()</code></a> iterates from the front of the bit-slice to the
|
||
back, with the final, possibly-shorter, segment at the back edge.</li>
|
||
</ul>
|
||
<h6 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">5</span>];
|
||
<span class="kw">for </span>(idx, chunk) <span class="kw">in unsafe </span>{
|
||
bits.rchunks_mut(<span class="number">2</span>).remove_alias()
|
||
}.enumerate() {
|
||
chunk.store(idx + <span class="number">1</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="comment">// remainder ^ ^^^^ ^^^^</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_exact" class="method"><h4 class="code-header">pub fn <a href="#method.rchunks_exact" class="fn">rchunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> RChunksExact<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping subslices of a bit-slice, from the back
|
||
edge.</p>
|
||
<p>If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the first
|
||
few bits are not yielded by the iterator at all. They can be accessed
|
||
with the <a href="crate::slice::RChunksExact::remainder"><code>.remainder()</code></a> method if the iterator is bound to a name.</p>
|
||
<h6 id="original-28"><a class="doc-anchor" href="#original-28">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_exact"><code>slice::rchunks_exact</code></a></p>
|
||
<h6 id="sibling-methods-6"><a class="doc-anchor" href="#sibling-methods-6">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rchunks" title="method common_base::bit_vec::prelude::BitSlice::rchunks"><code>.rchunks()</code></a> yields any leftover bits at the front as a shorter
|
||
chunk during iteration.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact_mut"><code>.rchunks_exact_mut()</code></a> has the same division logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact"><code>.chunks_exact()</code></a> iterates from the front of the bit-slice to the
|
||
back, with the unyielded remainder segment at the back edge.</li>
|
||
</ul>
|
||
<h6 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rchunks_exact(<span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert!</span>(iter.next().is_none());
|
||
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="macro">bits!</span>[<span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_exact_mut" class="method"><h4 class="code-header">pub fn <a href="#method.rchunks_exact_mut" class="fn">rchunks_exact_mut</a>(
|
||
&mut self,
|
||
chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||
) -> RChunksExactMut<'_, T, O></h4></section></summary><div class="docblock"><p>Iterates over non-overlapping mutable subslices of a bit-slice, from the
|
||
back edge.</p>
|
||
<p>If <code>self.len()</code> is not an even multiple of <code>chunk_size</code>, then the first
|
||
few bits are not yielded by the iterator at all. They can be accessed
|
||
with the <a href="crate::slice::RChunksExactMut::into_remainder"><code>.into_remainder()</code></a> method if the iterator is bound to a
|
||
name.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::RChunksExactMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="sibling-methods-7"><a class="doc-anchor" href="#sibling-methods-7">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_mut" title="method common_base::bit_vec::prelude::BitSlice::rchunks_mut"><code>.rchunks_mut()</code></a> yields any leftover bits at the front as a shorter
|
||
chunk during iteration.</li>
|
||
<li><a href="struct.BitSlice.html#method.rchunks_exact" title="method common_base::bit_vec::prelude::BitSlice::rchunks_exact"><code>.rchunks_exact()</code></a> has the same division logic, but each yielded
|
||
bit-slice is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.chunks_exact_mut" title="method common_base::bit_vec::prelude::BitSlice::chunks_exact_mut"><code>.chunks_exact_mut()</code></a> iterates from the front of the bit-slice
|
||
backwards, with the unyielded remainder segment at the back edge.</li>
|
||
</ul>
|
||
<h6 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h6>
|
||
<p>This panics if <code>chunk_size</code> is <code>0</code>.</p>
|
||
<h6 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">5</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rchunks_exact_mut(<span class="number">2</span>);
|
||
|
||
<span class="kw">for </span>(idx, chunk) <span class="kw">in </span>iter.by_ref().enumerate() {
|
||
chunk.store(idx + <span class="number">1</span>);
|
||
}
|
||
iter.into_remainder().store(<span class="number">1u8</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="comment">// remainder ^</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_at" class="method"><h4 class="code-header">pub fn <a href="#method.split_at" class="fn">split_at</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> (&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)</h4></section></summary><div class="docblock"><p>Splits a bit-slice in two parts at an index.</p>
|
||
<p>The returned bit-slices are <code>self[.. mid]</code> and <code>self[mid ..]</code>. <code>mid</code> is
|
||
included in the right bit-slice, not the left.</p>
|
||
<p>If <code>mid</code> is <code>0</code> then the left bit-slice is empty; if it is <code>self.len()</code>
|
||
then the right bit-slice is empty.</p>
|
||
<p>This method guarantees that even when either partition is empty, the
|
||
encoded bit-pointer values of the bit-slice references is <code>&self[0]</code> and
|
||
<code>&self[mid]</code>.</p>
|
||
<h6 id="original-29"><a class="doc-anchor" href="#original-29">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_at"><code>slice::split_at</code></a></p>
|
||
<h6 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h6>
|
||
<p>This panics if <code>mid</code> is greater than <code>self.len()</code>. It is allowed to be
|
||
equal to the length, in which case the right bit-slice is simply empty.</p>
|
||
<h6 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>base = bits.as_bitptr();
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at(<span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ a.as_bitptr().offset_from(base) }, <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ b.as_bitptr().offset_from(base) }, <span class="number">0</span>);
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at(<span class="number">6</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ b.as_bitptr().offset_from(base) }, <span class="number">6</span>);
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at(<span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(a, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">3</span>]);
|
||
<span class="macro">assert_eq!</span>(b, <span class="macro">bits!</span>[<span class="number">1</span>; <span class="number">3</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_mut" class="method"><h4 class="code-header">pub fn <a href="#method.split_at_mut" class="fn">split_at_mut</a>(
|
||
&mut self,
|
||
mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||
) -> (&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>)</h4></section></summary><div class="docblock"><p>Splits a mutable bit-slice in two parts at an index.</p>
|
||
<p>The returned bit-slices are <code>self[.. mid]</code> and <code>self[mid ..]</code>. <code>mid</code> is
|
||
included in the right bit-slice, not the left.</p>
|
||
<p>If <code>mid</code> is <code>0</code> then the left bit-slice is empty; if it is <code>self.len()</code>
|
||
then the right bit-slice is empty.</p>
|
||
<p>This method guarantees that even when either partition is empty, the
|
||
encoded bit-pointer values of the bit-slice references is <code>&self[0]</code> and
|
||
<code>&self[mid]</code>.</p>
|
||
<h6 id="original-30"><a class="doc-anchor" href="#original-30">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut"><code>slice::split_at_mut</code></a></p>
|
||
<h6 id="api-differences-13"><a class="doc-anchor" href="#api-differences-13">§</a>API Differences</h6>
|
||
<p>The end bits of the left half and the start bits of the right half might
|
||
be stored in the same memory element. In order to avoid breaking
|
||
<code>bitvec</code>’s memory-safety guarantees, both bit-slices are marked as
|
||
<code>T::Alias</code>. This marking allows them to be used without interfering with
|
||
each other when they interact with memory.</p>
|
||
<h6 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h6>
|
||
<p>This panics if <code>mid</code> is greater than <code>self.len()</code>. It is allowed to be
|
||
equal to the length, in which case the right bit-slice is simply empty.</p>
|
||
<h6 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span>u8, Msb0; <span class="number">0</span>; <span class="number">6</span>];
|
||
<span class="kw">let </span>base = bits.as_mut_bitptr();
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at_mut(<span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ a.as_mut_bitptr().offset_from(base) }, <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ b.as_mut_bitptr().offset_from(base) }, <span class="number">0</span>);
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at_mut(<span class="number">6</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="kw">unsafe </span>{ b.as_mut_bitptr().offset_from(base) }, <span class="number">6</span>);
|
||
|
||
<span class="kw">let </span>(a, b) = bits.split_at_mut(<span class="number">3</span>);
|
||
a.store(<span class="number">3</span>);
|
||
b.store(<span class="number">5</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method"><h4 class="code-header">pub fn <a href="#method.split" class="fn">split</a><F>(&self, pred: F) -> Split<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over subslices separated by bits that match a predicate. The
|
||
matched bit is <em>not</em> contained in the yielded bit-slices.</p>
|
||
<h6 id="original-31"><a class="doc-anchor" href="#original-31">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split"><code>slice::split</code></a></p>
|
||
<h6 id="api-differences-14"><a class="doc-anchor" href="#api-differences-14">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-8"><a class="doc-anchor" href="#sibling-methods-8">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.split_mut" title="method common_base::bit_vec::prelude::BitSlice::split_mut"><code>.split_mut()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split_inclusive" title="method common_base::bit_vec::prelude::BitSlice::split_inclusive"><code>.split_inclusive()</code></a> includes the matched bit in the yielded
|
||
bit-slice.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplit" title="method common_base::bit_vec::prelude::BitSlice::rsplit"><code>.rsplit()</code></a> iterates from the back of the bit-slice instead of the
|
||
front.</li>
|
||
<li><a href="struct.BitSlice.html#method.splitn" title="method common_base::bit_vec::prelude::BitSlice::splitn"><code>.splitn()</code></a> times out after <code>n</code> yields.</li>
|
||
</ul>
|
||
<h6 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.split(|pos, _bit| pos % <span class="number">3 </span>== <span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If the first bit is matched, then an empty bit-slice will be the first
|
||
item yielded by the iterator. Similarly, if the last bit in the
|
||
bit-slice matches, then an empty bit-slice will be the last item
|
||
yielded.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.split(|_pos, bit| <span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);
|
||
<span class="macro">assert!</span>(iter.next().unwrap().is_empty());
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If two matched bits are directly adjacent, then an empty bit-slice will
|
||
be yielded between them:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="comment">// ^ ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.split(|_pos, bit| !<span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().unwrap().is_empty());
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_mut" class="method"><h4 class="code-header">pub fn <a href="#method.split_mut" class="fn">split_mut</a><F>(&mut self, pred: F) -> SplitMut<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate. The matched bit is <em>not</em> contained in the yielded bit-slices.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::SplitMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-32"><a class="doc-anchor" href="#original-32">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_mut"><code>slice::split_mut</code></a></p>
|
||
<h6 id="api-differences-15"><a class="doc-anchor" href="#api-differences-15">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-9"><a class="doc-anchor" href="#sibling-methods-9">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.split" title="method common_base::bit_vec::prelude::BitSlice::split"><code>.split()</code></a> has the same splitting logic, but each yielded bit-slice
|
||
is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split_inclusive_mut" title="method common_base::bit_vec::prelude::BitSlice::split_inclusive_mut"><code>.split_inclusive_mut()</code></a> includes the matched bit in the yielded
|
||
bit-slice.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplit_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplit_mut"><code>.rsplit_mut()</code></a> iterates from the back of the bit-slice instead of
|
||
the front.</li>
|
||
<li><a href="struct.BitSlice.html#method.splitn_mut" title="method common_base::bit_vec::prelude::BitSlice::splitn_mut"><code>.splitn_mut()</code></a> times out after <code>n</code> yields.</li>
|
||
</ul>
|
||
<h6 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^ ^
|
||
</span><span class="kw">for </span>group <span class="kw">in </span>bits.split_mut(|_pos, bit| <span class="kw-2">*</span>bit) {
|
||
group.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_inclusive" class="method"><h4 class="code-header">pub fn <a href="#method.split_inclusive" class="fn">split_inclusive</a><F>(&self, pred: F) -> SplitInclusive<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over subslices separated by bits that match a predicate. Unlike
|
||
<code>.split()</code>, this <em>does</em> include the matching bit as the last bit in the
|
||
yielded bit-slice.</p>
|
||
<h6 id="original-33"><a class="doc-anchor" href="#original-33">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_inclusive"><code>slice::split_inclusive</code></a></p>
|
||
<h6 id="api-differences-16"><a class="doc-anchor" href="#api-differences-16">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-10"><a class="doc-anchor" href="#sibling-methods-10">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.split_inclusive_mut" title="method common_base::bit_vec::prelude::BitSlice::split_inclusive_mut"><code>.split_inclusive_mut()</code></a> has the same splitting logic, but each
|
||
yielded bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split" title="method common_base::bit_vec::prelude::BitSlice::split"><code>.split()</code></a> does not include the matched bit in the yielded
|
||
bit-slice.</li>
|
||
</ul>
|
||
<h6 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="comment">// ^ ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.split_inclusive(|_pos, bit| <span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_inclusive_mut" class="method"><h4 class="code-header">pub fn <a href="#method.split_inclusive_mut" class="fn">split_inclusive_mut</a><F>(
|
||
&mut self,
|
||
pred: F,
|
||
) -> SplitInclusiveMut<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate. Unlike <code>.split_mut()</code>, this <em>does</em> include the matching bit
|
||
as the last bit in the bit-slice.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::SplitInclusiveMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-34"><a class="doc-anchor" href="#original-34">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_inclusive_mut"><code>slice::split_inclusive_mut</code></a></p>
|
||
<h6 id="api-differences-17"><a class="doc-anchor" href="#api-differences-17">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-11"><a class="doc-anchor" href="#sibling-methods-11">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.split_inclusive" title="method common_base::bit_vec::prelude::BitSlice::split_inclusive"><code>.split_inclusive()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split_mut" title="method common_base::bit_vec::prelude::BitSlice::split_mut"><code>.split_mut()</code></a> does not include the matched bit in the yielded
|
||
bit-slice.</li>
|
||
</ul>
|
||
<h6 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">for </span>group <span class="kw">in </span>bits.split_inclusive_mut(|pos, _bit| pos % <span class="number">3 </span>== <span class="number">2</span>) {
|
||
group.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit" class="method"><h4 class="code-header">pub fn <a href="#method.rsplit" class="fn">rsplit</a><F>(&self, pred: F) -> RSplit<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over subslices separated by bits that match a predicate, from
|
||
the back edge. The matched bit is <em>not</em> contained in the yielded
|
||
bit-slices.</p>
|
||
<h6 id="original-35"><a class="doc-anchor" href="#original-35">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rsplit"><code>slice::rsplit</code></a></p>
|
||
<h6 id="api-differences-18"><a class="doc-anchor" href="#api-differences-18">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-12"><a class="doc-anchor" href="#sibling-methods-12">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rsplit_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplit_mut"><code>.rsplit_mut()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split" title="method common_base::bit_vec::prelude::BitSlice::split"><code>.split()</code></a> iterates from the front of the bit-slice instead of the
|
||
back.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn" title="method common_base::bit_vec::prelude::BitSlice::rsplitn"><code>.rsplitn()</code></a> times out after <code>n</code> yields.</li>
|
||
</ul>
|
||
<h6 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rsplit(|pos, _bit| pos % <span class="number">3 </span>== <span class="number">2</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If the last bit is matched, then an empty bit-slice will be the first
|
||
item yielded by the iterator. Similarly, if the first bit in the
|
||
bit-slice matches, then an empty bit-slice will be the last item
|
||
yielded.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rsplit(|_pos, bit| <span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert!</span>(iter.next().unwrap().is_empty());
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If two yielded bits are directly adjacent, then an empty bit-slice will
|
||
be yielded between them:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="comment">// ^ ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.split(|_pos, bit| !<span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().unwrap().is_empty());
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit_mut" class="method"><h4 class="code-header">pub fn <a href="#method.rsplit_mut" class="fn">rsplit_mut</a><F>(&mut self, pred: F) -> RSplitMut<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate, from the back. The matched bit is <em>not</em> contained in the
|
||
yielded bit-slices.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::RSplitMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-36"><a class="doc-anchor" href="#original-36">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rsplit_mut"><code>slice::rsplit_mut</code></a></p>
|
||
<h6 id="api-differences-19"><a class="doc-anchor" href="#api-differences-19">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-13"><a class="doc-anchor" href="#sibling-methods-13">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rsplit" title="method common_base::bit_vec::prelude::BitSlice::rsplit"><code>.rsplit()</code></a> has the same splitting logic, but each yielded bit-slice
|
||
is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.split_mut" title="method common_base::bit_vec::prelude::BitSlice::split_mut"><code>.split_mut()</code></a> iterates from the front of the bit-slice to the back.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplitn_mut"><code>.rsplitn_mut()</code></a> iterates from the front of the bit-slice to the
|
||
back.</li>
|
||
</ul>
|
||
<h6 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^ ^
|
||
</span><span class="kw">for </span>group <span class="kw">in </span>bits.rsplit_mut(|_pos, bit| <span class="kw-2">*</span>bit) {
|
||
group.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.splitn" class="method"><h4 class="code-header">pub fn <a href="#method.splitn" class="fn">splitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> SplitN<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over subslices separated by bits that match a predicate, giving
|
||
up after yielding <code>n</code> times. The <code>n</code>th yield contains the rest of the
|
||
bit-slice. As with <code>.split()</code>, the yielded bit-slices do not contain the
|
||
matched bit.</p>
|
||
<h6 id="original-37"><a class="doc-anchor" href="#original-37">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.splitn"><code>slice::splitn</code></a></p>
|
||
<h6 id="api-differences-20"><a class="doc-anchor" href="#api-differences-20">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-14"><a class="doc-anchor" href="#sibling-methods-14">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.splitn_mut" title="method common_base::bit_vec::prelude::BitSlice::splitn_mut"><code>.splitn_mut()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn" title="method common_base::bit_vec::prelude::BitSlice::rsplitn"><code>.rsplitn()</code></a> iterates from the back of the bit-slice instead of the
|
||
front.</li>
|
||
<li><a href="struct.BitSlice.html#method.split" title="method common_base::bit_vec::prelude::BitSlice::split"><code>.split()</code></a> has the same splitting logic, but never times out.</li>
|
||
</ul>
|
||
<h6 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = bits.splitn(<span class="number">2</span>, |_pos, bit| <span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.splitn_mut" class="method"><h4 class="code-header">pub fn <a href="#method.splitn_mut" class="fn">splitn_mut</a><F>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> SplitNMut<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate, giving up after yielding <code>n</code> times. The <code>n</code>th yield contains
|
||
the rest of the bit-slice. As with <code>.split_mut()</code>, the yielded
|
||
bit-slices do not contain the matched bit.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::SplitNMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-38"><a class="doc-anchor" href="#original-38">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.splitn_mut"><code>slice::splitn_mut</code></a></p>
|
||
<h6 id="api-differences-21"><a class="doc-anchor" href="#api-differences-21">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-15"><a class="doc-anchor" href="#sibling-methods-15">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.splitn" title="method common_base::bit_vec::prelude::BitSlice::splitn"><code>.splitn()</code></a> has the same splitting logic, but each yielded bit-slice
|
||
is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplitn_mut"><code>.rsplitn_mut()</code></a> iterates from the back of the bit-slice instead of
|
||
the front.</li>
|
||
<li><a href="struct.BitSlice.html#method.split_mut" title="method common_base::bit_vec::prelude::BitSlice::split_mut"><code>.split_mut()</code></a> has the same splitting logic, but never times out.</li>
|
||
</ul>
|
||
<h6 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="kw">for </span>group <span class="kw">in </span>bits.splitn_mut(<span class="number">2</span>, |_pos, bit| <span class="kw-2">*</span>bit) {
|
||
group.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplitn" class="method"><h4 class="code-header">pub fn <a href="#method.rsplitn" class="fn">rsplitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> RSplitN<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate from the back edge, giving up after yielding <code>n</code> times. The
|
||
<code>n</code>th yield contains the rest of the bit-slice. As with <code>.split_mut()</code>,
|
||
the yielded bit-slices do not contain the matched bit.</p>
|
||
<h6 id="original-39"><a class="doc-anchor" href="#original-39">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rsplitn"><code>slice::rsplitn</code></a></p>
|
||
<h6 id="api-differences-22"><a class="doc-anchor" href="#api-differences-22">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-16"><a class="doc-anchor" href="#sibling-methods-16">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplitn_mut"><code>.rsplitn_mut()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is mutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.splitn" title="method common_base::bit_vec::prelude::BitSlice::splitn"><code>.splitn()</code></a>: iterates from the front of the bit-slice instead of the
|
||
back.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplit" title="method common_base::bit_vec::prelude::BitSlice::rsplit"><code>.rsplit()</code></a> has the same splitting logic, but never times out.</li>
|
||
</ul>
|
||
<h6 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// ^
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>iter = bits.rsplitn(<span class="number">2</span>, |_pos, bit| <span class="kw-2">*</span>bit);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rsplitn_mut" class="method"><h4 class="code-header">pub fn <a href="#method.rsplitn_mut" class="fn">rsplitn_mut</a><F>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> RSplitNMut<'_, T, O, F><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/std/primitive.usize.html">usize</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Iterates over mutable subslices separated by bits that match a
|
||
predicate from the back edge, giving up after yielding <code>n</code> times. The
|
||
<code>n</code>th yield contains the rest of the bit-slice. As with <code>.split_mut()</code>,
|
||
the yielded bit-slices do not contain the matched bit.</p>
|
||
<p>Iterators do not require that each yielded item is destroyed before the
|
||
next is produced. This means that each bit-slice yielded must be marked
|
||
as aliased. If you are using this in a loop that does not collect
|
||
multiple yielded subslices for the same scope, then you can remove the
|
||
alias marking by calling the (<code>unsafe</code>) method <a href="crate::slice::RSplitNMut::remove_alias"><code>.remove_alias()</code></a> on
|
||
the iterator.</p>
|
||
<h6 id="original-40"><a class="doc-anchor" href="#original-40">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rsplitn_mut"><code>slice::rsplitn_mut</code></a></p>
|
||
<h6 id="api-differences-23"><a class="doc-anchor" href="#api-differences-23">§</a>API Differences</h6>
|
||
<p>The predicate function receives the index being tested as well as the
|
||
bit value at that index. This allows the predicate to have more than one
|
||
bit of information about the bit-slice being traversed.</p>
|
||
<h6 id="sibling-methods-17"><a class="doc-anchor" href="#sibling-methods-17">§</a>Sibling Methods</h6>
|
||
<ul>
|
||
<li><a href="struct.BitSlice.html#method.rsplitn" title="method common_base::bit_vec::prelude::BitSlice::rsplitn"><code>.rsplitn()</code></a> has the same splitting logic, but each yielded
|
||
bit-slice is immutable.</li>
|
||
<li><a href="struct.BitSlice.html#method.splitn_mut" title="method common_base::bit_vec::prelude::BitSlice::splitn_mut"><code>.splitn_mut()</code></a> iterates from the front of the bit-slice instead of
|
||
the back.</li>
|
||
<li><a href="struct.BitSlice.html#method.rsplit_mut" title="method common_base::bit_vec::prelude::BitSlice::rsplit_mut"><code>.rsplit_mut()</code></a> has the same splitting logic, but never times out.</li>
|
||
</ul>
|
||
<h6 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="kw">for </span>group <span class="kw">in </span>bits.rsplitn_mut(<span class="number">2</span>, |_idx, bit| <span class="kw-2">*</span>bit) {
|
||
group.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]);
|
||
<span class="comment">// ^ group 2 ^ group 1</span></code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><h4 class="code-header">pub fn <a href="#method.contains" class="fn">contains</a><T2, O2>(&self, other: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Tests if the bit-slice contains the given sequence anywhere within it.</p>
|
||
<p>This scans over <code>self.windows(other.len())</code> until one of the windows
|
||
matches. The search key does not need to share type parameters with the
|
||
bit-slice being tested, as the comparison is bit-wise. However, sharing
|
||
type parameters will accelerate the comparison.</p>
|
||
<h6 id="original-41"><a class="doc-anchor" href="#original-41">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.contains"><code>slice::contains</code></a></p>
|
||
<h6 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="macro">assert!</span>( bits.contains(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert!</span>(!bits.contains(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.starts_with" class="method"><h4 class="code-header">pub fn <a href="#method.starts_with" class="fn">starts_with</a><T2, O2>(&self, needle: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Tests if the bit-slice begins with the given sequence.</p>
|
||
<p>The search key does not need to share type parameters with the bit-slice
|
||
being tested, as the comparison is bit-wise. However, sharing type
|
||
parameters will accelerate the comparison.</p>
|
||
<h6 id="original-42"><a class="doc-anchor" href="#original-42">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.starts_with"><code>slice::starts_with</code></a></p>
|
||
<h6 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert!</span>( bits.starts_with(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));
|
||
<span class="macro">assert!</span>(!bits.starts_with(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]));</code></pre></div>
|
||
<p>This always returns <code>true</code> if the needle is empty:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="kw">let </span>empty = <span class="macro">bits!</span>[];
|
||
<span class="macro">assert!</span>(bits.starts_with(empty));
|
||
<span class="macro">assert!</span>(empty.starts_with(empty));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.ends_with" class="method"><h4 class="code-header">pub fn <a href="#method.ends_with" class="fn">ends_with</a><T2, O2>(&self, needle: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a><div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Tests if the bit-slice ends with the given sequence.</p>
|
||
<p>The search key does not need to share type parameters with the bit-slice
|
||
being tested, as the comparison is bit-wise. However, sharing type
|
||
parameters will accelerate the comparison.</p>
|
||
<h6 id="original-43"><a class="doc-anchor" href="#original-43">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.ends_with"><code>slice::ends_with</code></a></p>
|
||
<h6 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert!</span>( bits.ends_with(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]));
|
||
<span class="macro">assert!</span>(!bits.ends_with(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]));</code></pre></div>
|
||
<p>This always returns <code>true</code> if the needle is empty:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="kw">let </span>empty = <span class="macro">bits!</span>[];
|
||
<span class="macro">assert!</span>(bits.ends_with(empty));
|
||
<span class="macro">assert!</span>(empty.ends_with(empty));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.strip_prefix" class="method"><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fn">strip_prefix</a><T2, O2>(
|
||
&self,
|
||
prefix: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>,
|
||
) -> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>><div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Removes a prefix bit-slice, if present.</p>
|
||
<p>Like <a href="struct.BitSlice.html#method.starts_with" title="method common_base::bit_vec::prelude::BitSlice::starts_with"><code>.starts_with()</code></a>, the search key does not need to share type
|
||
parameters with the bit-slice being stripped. If
|
||
<code>self.starts_with(suffix)</code>, then this returns <code>Some(&self[prefix.len() ..])</code>, otherwise it returns <code>None</code>.</p>
|
||
<h6 id="original-44"><a class="doc-anchor" href="#original-44">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.strip_prefix"><code>slice::strip_prefix</code></a></p>
|
||
<h6 id="api-differences-24"><a class="doc-anchor" href="#api-differences-24">§</a>API Differences</h6>
|
||
<p><code>BitSlice</code> does not support pattern searches; instead, it permits <code>self</code>
|
||
and <code>prefix</code> to differ in type parameters.</p>
|
||
<h6 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits.strip_prefix(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]).unwrap(), bits[<span class="number">2 </span>..]);
|
||
<span class="macro">assert_eq!</span>(bits.strip_prefix(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>,]).unwrap(), bits[<span class="number">4 </span>..]);
|
||
<span class="macro">assert!</span>(bits.strip_prefix(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]).is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.strip_suffix" class="method"><h4 class="code-header">pub fn <a href="#method.strip_suffix" class="fn">strip_suffix</a><T2, O2>(
|
||
&self,
|
||
suffix: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>,
|
||
) -> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>><div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Removes a suffix bit-slice, if present.</p>
|
||
<p>Like <a href="Self::ends_with."><code>.ends_with()</code></a>, the search key does not need to share type
|
||
parameters with the bit-slice being stripped. If
|
||
<code>self.ends_with(suffix)</code>, then this returns <code>Some(&self[.. self.len() - suffix.len()])</code>, otherwise it returns <code>None</code>.</p>
|
||
<h6 id="original-45"><a class="doc-anchor" href="#original-45">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.strip_suffix"><code>slice::strip_suffix</code></a></p>
|
||
<h6 id="api-differences-25"><a class="doc-anchor" href="#api-differences-25">§</a>API Differences</h6>
|
||
<p><code>BitSlice</code> does not support pattern searches; instead, it permits <code>self</code>
|
||
and <code>suffix</code> to differ in type parameters.</p>
|
||
<h6 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits.strip_suffix(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]).unwrap(), bits[.. <span class="number">7</span>]);
|
||
<span class="macro">assert_eq!</span>(bits.strip_suffix(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]).unwrap(), bits[.. <span class="number">5</span>]);
|
||
<span class="macro">assert!</span>(bits.strip_suffix(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>]).is_none());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rotate_left" class="method"><h4 class="code-header">pub fn <a href="#method.rotate_left" class="fn">rotate_left</a>(&mut self, by: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Rotates the contents of a bit-slice to the left (towards the zero
|
||
index).</p>
|
||
<p>This essentially splits the bit-slice at <code>by</code>, then exchanges the two
|
||
pieces. <code>self[.. by]</code> becomes the first section, and is then followed by
|
||
<code>self[.. by]</code>.</p>
|
||
<p>The implementation is batch-accelerated where possible. It should have a
|
||
runtime complexity much lower than <code>O(by)</code>.</p>
|
||
<h6 id="original-46"><a class="doc-anchor" href="#original-46">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rotate_left"><code>slice::rotate_left</code></a></p>
|
||
<h6 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// split occurs here ^
|
||
</span>bits.rotate_left(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rotate_right" class="method"><h4 class="code-header">pub fn <a href="#method.rotate_right" class="fn">rotate_right</a>(&mut self, by: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Rotates the contents of a bit-slice to the right (away from the zero
|
||
index).</p>
|
||
<p>This essentially splits the bit-slice at <code>self.len() - by</code>, then
|
||
exchanges the two pieces. <code>self[len - by ..]</code> becomes the first section,
|
||
and is then followed by <code>self[.. len - by]</code>.</p>
|
||
<p>The implementation is batch-accelerated where possible. It should have a
|
||
runtime complexity much lower than <code>O(by)</code>.</p>
|
||
<h6 id="original-47"><a class="doc-anchor" href="#original-47">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.rotate_right"><code>slice::rotate_right</code></a></p>
|
||
<h6 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="comment">// split occurs here ^
|
||
</span>bits.rotate_right(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fill" class="method"><h4 class="code-header">pub fn <a href="#method.fill" class="fn">fill</a>(&mut self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Fills the bit-slice with a given bit.</p>
|
||
<p>This is a recent stabilization in the standard library. <code>bitvec</code>
|
||
previously offered this behavior as the novel API <code>.set_all()</code>. That
|
||
method name is now removed in favor of this standard-library analogue.</p>
|
||
<h6 id="original-48"><a class="doc-anchor" href="#original-48">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.fill"><code>slice::fill</code></a></p>
|
||
<h6 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">5</span>];
|
||
bits.fill(<span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>; <span class="number">5</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.fill_with" class="method"><h4 class="code-header">pub fn <a href="#method.fill_with" class="fn">fill_with</a><F>(&mut self, func: F)<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/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Fills the bit-slice with bits produced by a generator function.</p>
|
||
<h6 id="original-49"><a class="doc-anchor" href="#original-49">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.fill_with"><code>slice::fill_with</code></a></p>
|
||
<h6 id="api-differences-26"><a class="doc-anchor" href="#api-differences-26">§</a>API Differences</h6>
|
||
<p>The generator function receives the index of the bit being initialized
|
||
as an argument.</p>
|
||
<h6 id="examples-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>; <span class="number">5</span>];
|
||
bits.fill_with(|idx| idx % <span class="number">2 </span>== <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);</code></pre></div></div></details><section id="method.clone_from_slice" class="method"><h4 class="code-header">pub fn <a href="#method.clone_from_slice" class="fn">clone_from_slice</a><T2, O2>(&mut self, src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)<div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.clone_from_bitslice()</code> instead</span></div></span><section id="method.copy_from_slice" class="method"><h4 class="code-header">pub fn <a href="#method.copy_from_slice" class="fn">copy_from_slice</a>(&mut self, src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.copy_from_bitslice()</code> instead</span></div></span><details class="toggle method-toggle" open><summary><section id="method.copy_within" class="method"><h4 class="code-header">pub fn <a href="#method.copy_within" class="fn">copy_within</a><R>(&mut self, src: R, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)<div class="where">where
|
||
R: RangeExt<<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,</div></h4></section></summary><div class="docblock"><p>Copies a span of bits to another location in the bit-slice.</p>
|
||
<p><code>src</code> is the range of bit-indices in the bit-slice to copy, and <code>dest is the starting index of the destination range. </code>src<code>and</code>dest .. dest +
|
||
src.len()<code>are permitted to overlap; the copy will automatically detect and manage this. However, both</code>src<code>and</code>dest .. dest + src.len()<code>**must** fall within the bounds of</code>self`.</p>
|
||
<h6 id="original-50"><a class="doc-anchor" href="#original-50">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within"><code>slice::copy_within</code></a></p>
|
||
<h6 id="panics-11"><a class="doc-anchor" href="#panics-11">§</a>Panics</h6>
|
||
<p>This panics if either the source or destination range exceed
|
||
<code>self.len()</code>.</p>
|
||
<h6 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
bits.copy_within(<span class="number">1 </span>.. <span class="number">5</span>, <span class="number">8</span>);
|
||
<span class="comment">// v v v v
|
||
</span><span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);
|
||
<span class="comment">// ^ ^ ^ ^</span></code></pre></div></div></details><section id="method.swap_with_slice" class="method"><h4 class="code-header">pub fn <a href="#method.swap_with_slice" class="fn">swap_with_slice</a><T2, O2>(&mut self, other: &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)<div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.swap_with_bitslice()</code> instead</span></div></span><details class="toggle method-toggle" open><summary><section id="method.align_to" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.align_to" class="fn">align_to</a><U>(
|
||
&self,
|
||
) -> (&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><U, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)<div class="where">where
|
||
U: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h4></section></summary><div class="docblock"><p>Produces bit-slice view(s) with different underlying storage types.</p>
|
||
<p>This may have unexpected effects, and you cannot assume that
|
||
<code>before[idx] == after[idx]</code>! Consult the <a href="https://bitvecto-rs.github.io/bitvec/memory-layout.html">tables in the manual</a>
|
||
for information about memory layouts.</p>
|
||
<h6 id="original-51"><a class="doc-anchor" href="#original-51">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.align_to"><code>slice::align_to</code></a></p>
|
||
<h6 id="notes"><a class="doc-anchor" href="#notes">§</a>Notes</h6>
|
||
<p>Unlike the standard library documentation, this explicitly guarantees
|
||
that the middle bit-slice will have maximal size. You may rely on this
|
||
property.</p>
|
||
<h6 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h6>
|
||
<p>You may not use this to cast away alias protections. Rust does not have
|
||
support for higher-kinded types, so this cannot express the relation
|
||
<code>Outer<T> -> Outer<U> where Outer: BitStoreContainer</code>, but memory safety
|
||
does require that you respect this rule. Reälign integers to integers,
|
||
<code>Cell</code>s to <code>Cell</code>s, and atomics to atomics, but do not cross these
|
||
boundaries.</p>
|
||
<h6 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bytes: [u8; <span class="number">7</span>] = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
|
||
<span class="kw">let </span>bits = bytes.view_bits::<Lsb0>();
|
||
<span class="kw">let </span>(pfx, mid, sfx) = <span class="kw">unsafe </span>{
|
||
bits.align_to::<u16>()
|
||
};
|
||
<span class="macro">assert!</span>(pfx.len() <= <span class="number">8</span>);
|
||
<span class="macro">assert_eq!</span>(mid.len(), <span class="number">48</span>);
|
||
<span class="macro">assert!</span>(sfx.len() <= <span class="number">8</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.align_to_mut" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.align_to_mut" class="fn">align_to_mut</a><U>(
|
||
&mut self,
|
||
) -> (&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><U, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)<div class="where">where
|
||
U: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h4></section></summary><div class="docblock"><p>Produces bit-slice view(s) with different underlying storage types.</p>
|
||
<p>This may have unexpected effects, and you cannot assume that
|
||
<code>before[idx] == after[idx]</code>! Consult the <a href="https://bitvecto-rs.github.io/bitvec/memory-layout.html">tables in the manual</a>
|
||
for information about memory layouts.</p>
|
||
<h6 id="original-52"><a class="doc-anchor" href="#original-52">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.align_to_mut"><code>slice::align_to_mut</code></a></p>
|
||
<h6 id="notes-1"><a class="doc-anchor" href="#notes-1">§</a>Notes</h6>
|
||
<p>Unlike the standard library documentation, this explicitly guarantees
|
||
that the middle bit-slice will have maximal size. You may rely on this
|
||
property.</p>
|
||
<h6 id="safety-4"><a class="doc-anchor" href="#safety-4">§</a>Safety</h6>
|
||
<p>You may not use this to cast away alias protections. Rust does not have
|
||
support for higher-kinded types, so this cannot express the relation
|
||
<code>Outer<T> -> Outer<U> where Outer: BitStoreContainer</code>, but memory safety
|
||
does require that you respect this rule. Reälign integers to integers,
|
||
<code>Cell</code>s to <code>Cell</code>s, and atomics to atomics, but do not cross these
|
||
boundaries.</p>
|
||
<h6 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>bytes: [u8; <span class="number">7</span>] = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
|
||
<span class="kw">let </span>bits = bytes.view_bits_mut::<Lsb0>();
|
||
<span class="kw">let </span>(pfx, mid, sfx) = <span class="kw">unsafe </span>{
|
||
bits.align_to_mut::<u16>()
|
||
};
|
||
<span class="macro">assert!</span>(pfx.len() <= <span class="number">8</span>);
|
||
<span class="macro">assert_eq!</span>(mid.len(), <span class="number">48</span>);
|
||
<span class="macro">assert!</span>(sfx.len() <= <span class="number">8</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-1" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-1" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><section id="method.to_vec" class="method"><h4 class="code-header">pub fn <a href="#method.to_vec" class="fn">to_vec</a>(&self) -> <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Unalias" title="type common_base::bit_vec::prelude::BitStore::Unalias">Unalias</a>, O> <a href="#" class="tooltip" data-notable-ty="BitVec<<T as BitStore>::Unalias, O>">ⓘ</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use <code>.to_bitvec()</code> instead</span></div></span><details class="toggle method-toggle" open><summary><section id="method.repeat" class="method"><h4 class="code-header">pub fn <a href="#method.repeat" class="fn">repeat</a>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Unalias" title="type common_base::bit_vec::prelude::BitStore::Unalias">Unalias</a>, O> <a href="#" class="tooltip" data-notable-ty="BitVec<<T as BitStore>::Unalias, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Creates a bit-vector by repeating a bit-slice <code>n</code> times.</p>
|
||
<h6 id="original-53"><a class="doc-anchor" href="#original-53">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.repeat"><code>slice::repeat</code></a></p>
|
||
<h6 id="panics-12"><a class="doc-anchor" href="#panics-12">§</a>Panics</h6>
|
||
<p>This method panics if <code>self.len() * n</code> exceeds the <code>BitVec</code> capacity.</p>
|
||
<h6 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].repeat(<span class="number">3</span>), <span class="macro">bitvec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>]);</code></pre></div>
|
||
<p>This panics by exceeding bit-vector maximum capacity:</p>
|
||
|
||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].repeat(BitSlice::<usize, Lsb0>::MAX_BITS);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-2" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-2" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Constructors.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.empty" class="method"><h4 class="code-header">pub fn <a href="#method.empty" class="fn">empty</a><'a>() -> &'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&'a BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Produces an empty bit-slice with an arbitrary lifetime.</p>
|
||
<h6 id="original-54"><a class="doc-anchor" href="#original-54">§</a>Original</h6>
|
||
<p>This is equivalent to the <code>&[]</code> literal.</p>
|
||
<h6 id="examples-52"><a class="doc-anchor" href="#examples-52">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(BitSlice::<u16, LocalBits>::empty().is_empty());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[], BitSlice::<u8, Msb0>::empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.empty_mut" class="method"><h4 class="code-header">pub fn <a href="#method.empty_mut" class="fn">empty_mut</a><'a>() -> &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&'a mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Produces an empty bit-slice with an arbitrary lifetime.</p>
|
||
<h6 id="original-55"><a class="doc-anchor" href="#original-55">§</a>Original</h6>
|
||
<p>This is equivalent to the <code>&mut []</code> literal.</p>
|
||
<h6 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(BitSlice::<u16, LocalBits>::empty_mut().is_empty());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="kw-2">mut</span>], BitSlice::<u8, Msb0>::empty_mut());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_element" class="method"><h4 class="code-header">pub fn <a href="#method.from_element" class="fn">from_element</a>(elem: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs a shared <code>&BitSlice</code> reference over a shared element.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait, implemented on all <a href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore"><code>BitStore</code></a> implementors,
|
||
provides a <a href="trait._.html#tymethod.view_bits" title="method common_base::bit_vec::prelude::_::view_bits"><code>.view_bits::<O>()</code></a> method which delegates to this function
|
||
and may be more convenient for you to write.</p>
|
||
<h6 id="parameters"><a class="doc-anchor" href="#parameters">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>elem</code>: A shared reference to a memory element.</li>
|
||
</ul>
|
||
<h6 id="returns"><a class="doc-anchor" href="#returns">§</a>Returns</h6>
|
||
<p>A shared <code>&BitSlice</code> over <code>elem</code>.</p>
|
||
<h6 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>elem = <span class="number">0u8</span>;
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Lsb0>::from_element(<span class="kw-2">&</span>elem);
|
||
<span class="macro">assert_eq!</span>(bits.len(), <span class="number">8</span>);
|
||
|
||
<span class="kw">let </span>bits = elem.view_bits::<Lsb0>();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_element_mut" class="method"><h4 class="code-header">pub fn <a href="#method.from_element_mut" class="fn">from_element_mut</a>(elem: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs an exclusive <code>&mut BitSlice</code> reference over an element.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait, implemented on all <a href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore"><code>BitStore</code></a> implementors,
|
||
provides a <a href="trait._.html#tymethod.view_bits_mut" title="method common_base::bit_vec::prelude::_::view_bits_mut"><code>.view_bits_mut::<O>()</code></a> method which delegates to this
|
||
function and may be more convenient for you to write.</p>
|
||
<h6 id="parameters-1"><a class="doc-anchor" href="#parameters-1">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>elem</code>: An exclusive reference to a memory element.</li>
|
||
</ul>
|
||
<h6 id="returns-1"><a class="doc-anchor" href="#returns-1">§</a>Returns</h6>
|
||
<p>An exclusive <code>&mut BitSlice</code> over <code>elem</code>.</p>
|
||
<p>Note that the original <code>elem</code> reference will be inaccessible for the
|
||
duration of the returned bit-slice handle’s lifetime.</p>
|
||
<h6 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>elem = <span class="number">0u8</span>;
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Lsb0>::from_element_mut(<span class="kw-2">&mut </span>elem);
|
||
bits.set(<span class="number">1</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert!</span>(bits[<span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(elem, <span class="number">2</span>);
|
||
|
||
<span class="kw">let </span>bits = elem.view_bits_mut::<Lsb0>();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_slice" class="method"><h4 class="code-header">pub fn <a href="#method.from_slice" class="fn">from_slice</a>(slice: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs a shared <code>&BitSlice</code> reference over a slice of elements.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait, implemented on all <code>[T]</code> slices, provides a
|
||
<a href="trait._.html#tymethod.view_bits" title="method common_base::bit_vec::prelude::_::view_bits"><code>.view_bits::<O>()</code></a> method which delegates to this function and may be
|
||
more convenient for you to write.</p>
|
||
<h6 id="parameters-2"><a class="doc-anchor" href="#parameters-2">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>slice</code>: A shared reference to a slice of memory elements.</li>
|
||
</ul>
|
||
<h6 id="returns-2"><a class="doc-anchor" href="#returns-2">§</a>Returns</h6>
|
||
<p>A shared <code>BitSlice</code> reference over all of <code>slice</code>.</p>
|
||
<h6 id="panics-13"><a class="doc-anchor" href="#panics-13">§</a>Panics</h6>
|
||
<p>This will panic if <code>slice</code> is too long to encode as a bit-slice view.</p>
|
||
<h6 id="examples-56"><a class="doc-anchor" href="#examples-56">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [<span class="number">0u16</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Lsb0>::from_slice(<span class="kw-2">&</span>data);
|
||
<span class="macro">assert!</span>(bits[<span class="number">16</span>]);
|
||
|
||
<span class="kw">let </span>bits = data.view_bits::<Lsb0>();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.try_from_slice" class="method"><h4 class="code-header">pub fn <a href="#method.try_from_slice" class="fn">try_from_slice</a>(slice: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, BitSpanError<T>></h4></section></summary><div class="docblock"><p>Attempts to construct a shared <code>&BitSlice</code> reference over a slice of
|
||
elements.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a>, implemented on all <code>[T]</code> slices, provides a
|
||
<a href="trait._.html#tymethod.try_view_bits" title="method common_base::bit_vec::prelude::_::try_view_bits"><code>.try_view_bits::<O>()</code></a> method which delegates to this function and
|
||
may be more convenient for you to write.</p>
|
||
<p>This is <em>very hard</em>, if not impossible, to cause to fail. Rust will not
|
||
create excessive arrays on 64-bit architectures.</p>
|
||
<h6 id="parameters-3"><a class="doc-anchor" href="#parameters-3">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>slice</code>: A shared reference to a slice of memory elements.</li>
|
||
</ul>
|
||
<h6 id="returns-3"><a class="doc-anchor" href="#returns-3">§</a>Returns</h6>
|
||
<p>A shared <code>&BitSlice</code> over <code>slice</code>. If <code>slice</code> is longer than can be
|
||
encoded into a <code>&BitSlice</code> (see <a href="struct.BitSlice.html#associatedconstant.MAX_ELTS" title="associated constant common_base::bit_vec::prelude::BitSlice::MAX_ELTS"><code>MAX_ELTS</code></a>), this will fail and return
|
||
the original <code>slice</code> as an error.</p>
|
||
<h6 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [<span class="number">0u8</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Msb0>::try_from_slice(<span class="kw-2">&</span>data).unwrap();
|
||
<span class="macro">assert!</span>(bits[<span class="number">15</span>]);
|
||
|
||
<span class="kw">let </span>bits = data.try_view_bits::<Msb0>().unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_slice_mut" class="method"><h4 class="code-header">pub fn <a href="#method.from_slice_mut" class="fn">from_slice_mut</a>(slice: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs an exclusive <code>&mut BitSlice</code> reference over a slice of
|
||
elements.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait, implemented on all <code>[T]</code> slices, provides a
|
||
<a href="trait._.html#tymethod.view_bits_mut" title="method common_base::bit_vec::prelude::_::view_bits_mut"><code>.view_bits_mut::<O>()</code></a> method which delegates to this function and
|
||
may be more convenient for you to write.</p>
|
||
<h6 id="parameters-4"><a class="doc-anchor" href="#parameters-4">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>slice</code>: An exclusive reference to a slice of memory elements.</li>
|
||
</ul>
|
||
<h6 id="returns-4"><a class="doc-anchor" href="#returns-4">§</a>Returns</h6>
|
||
<p>An exclusive <code>&mut BitSlice</code> over all of <code>slice</code>.</p>
|
||
<h6 id="panics-14"><a class="doc-anchor" href="#panics-14">§</a>Panics</h6>
|
||
<p>This panics if <code>slice</code> is too long to encode as a bit-slice view.</p>
|
||
<h6 id="examples-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = [<span class="number">0u16</span>; <span class="number">2</span>];
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Lsb0>::from_slice_mut(<span class="kw-2">&mut </span>data);
|
||
bits.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
bits.set(<span class="number">17</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(data, [<span class="number">1</span>, <span class="number">2</span>]);
|
||
|
||
<span class="kw">let </span>bits = data.view_bits_mut::<Lsb0>();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.try_from_slice_mut" class="method"><h4 class="code-header">pub fn <a href="#method.try_from_slice_mut" class="fn">try_from_slice_mut</a>(
|
||
slice: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, BitSpanError<T>></h4></section></summary><div class="docblock"><p>Attempts to construct an exclusive <code>&mut BitSlice</code> reference over a
|
||
slice of elements.</p>
|
||
<p>The <a href="trait._.html" title="trait common_base::bit_vec::prelude::_"><code>BitView</code></a> trait, implemented on all <code>[T]</code> slices, provides a
|
||
<a href="trait._.html#tymethod.try_view_bits_mut" title="method common_base::bit_vec::prelude::_::try_view_bits_mut"><code>.try_view_bits_mut::<O>()</code></a> method which delegates to this function
|
||
and may be more convenient for you to write.</p>
|
||
<h6 id="parameters-5"><a class="doc-anchor" href="#parameters-5">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>slice</code>: An exclusive reference to a slice of memory elements.</li>
|
||
</ul>
|
||
<h6 id="returns-5"><a class="doc-anchor" href="#returns-5">§</a>Returns</h6>
|
||
<p>An exclusive <code>&mut BitSlice</code> over <code>slice</code>. If <code>slice</code> is longer than can
|
||
be encoded into a <code>&mut BitSlice</code> (see <a href="struct.BitSlice.html#associatedconstant.MAX_ELTS" title="associated constant common_base::bit_vec::prelude::BitSlice::MAX_ELTS"><code>MAX_ELTS</code></a>), this will fail and
|
||
return the original <code>slice</code> as an error.</p>
|
||
<h6 id="examples-59"><a class="doc-anchor" href="#examples-59">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = [<span class="number">0u8</span>; <span class="number">2</span>];
|
||
<span class="kw">let </span>bits = BitSlice::<<span class="kw">_</span>, Msb0>::try_from_slice_mut(<span class="kw-2">&mut </span>data).unwrap();
|
||
bits.set(<span class="number">7</span>, <span class="bool-val">true</span>);
|
||
bits.set(<span class="number">15</span>, <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(data, [<span class="number">1</span>; <span class="number">2</span>]);
|
||
|
||
<span class="kw">let </span>bits = data.try_view_bits_mut::<Msb0>().unwrap();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_slice_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.from_slice_unchecked" class="fn">from_slice_unchecked</a>(slice: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs a shared <code>&BitSlice</code> over an element slice, without checking
|
||
its length.</p>
|
||
<p>If <code>slice</code> is too long to encode into a <code>&BitSlice</code>, then the produced
|
||
bit-slice’s length is unspecified.</p>
|
||
<h6 id="safety-5"><a class="doc-anchor" href="#safety-5">§</a>Safety</h6>
|
||
<p>You must ensure that <code>slice.len() < BitSlice::MAX_ELTS</code>.</p>
|
||
<p>Calling this function with an over-long slice is <strong>library-level</strong>
|
||
undefined behavior. You may not assume anything about its implementation
|
||
or behavior, and must conservatively assume that over-long slices cause
|
||
compiler UB.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_slice_unchecked_mut" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.from_slice_unchecked_mut" class="fn">from_slice_unchecked_mut</a>(slice: &mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Constructs an exclusive <code>&mut BitSlice</code> over an element slice, without
|
||
checking its length.</p>
|
||
<p>If <code>slice</code> is too long to encode into a <code>&mut BitSlice</code>, then the
|
||
produced bit-slice’s length is unspecified.</p>
|
||
<h6 id="safety-6"><a class="doc-anchor" href="#safety-6">§</a>Safety</h6>
|
||
<p>You must ensure that <code>slice.len() < BitSlice::MAX_ELTS</code>.</p>
|
||
<p>Calling this function with an over-long slice is <strong>library-level</strong>
|
||
undefined behavior. You may not assume anything about its implementation
|
||
or behavior, and must conservatively assume that over-long slices cause
|
||
compiler UB.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-3" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-3" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Alternates of standard APIs.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_bitptr" class="method"><h4 class="code-header">pub fn <a href="#method.as_bitptr" class="fn">as_bitptr</a>(&self) -> <a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Const, T, O></h4></section></summary><div class="docblock"><p>Gets a raw pointer to the zeroth bit of the bit-slice.</p>
|
||
<h6 id="original-56"><a class="doc-anchor" href="#original-56">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr"><code>slice::as_ptr</code></a></p>
|
||
<h6 id="api-differences-27"><a class="doc-anchor" href="#api-differences-27">§</a>API Differences</h6>
|
||
<p>This is renamed in order to indicate that it is returning a <code>bitvec</code>
|
||
structure, not a raw pointer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_bitptr" class="method"><h4 class="code-header">pub fn <a href="#method.as_mut_bitptr" class="fn">as_mut_bitptr</a>(&mut self) -> <a class="struct" href="struct.BitPtr.html" title="struct common_base::bit_vec::prelude::BitPtr">BitPtr</a><Mut, T, O></h4></section></summary><div class="docblock"><p>Gets a raw, write-capable pointer to the zeroth bit of the bit-slice.</p>
|
||
<h6 id="original-57"><a class="doc-anchor" href="#original-57">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr"><code>slice::as_mut_ptr</code></a></p>
|
||
<h6 id="api-differences-28"><a class="doc-anchor" href="#api-differences-28">§</a>API Differences</h6>
|
||
<p>This is renamed in order to indicate that it is returning a <code>bitvec</code>
|
||
structure, not a raw pointer.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_bitptr_range" class="method"><h4 class="code-header">pub fn <a href="#method.as_bitptr_range" class="fn">as_bitptr_range</a>(&self) -> <a class="struct" href="struct.BitPtrRange.html" title="struct common_base::bit_vec::prelude::BitPtrRange">BitPtrRange</a><Const, T, O> <a href="#" class="tooltip" data-notable-ty="BitPtrRange<Const, T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Views the bit-slice as a half-open range of bit-pointers, to its first
|
||
bit <em>in</em> the bit-slice and first bit <em>beyond</em> it.</p>
|
||
<h6 id="original-58"><a class="doc-anchor" href="#original-58">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range"><code>slice::as_ptr_range</code></a></p>
|
||
<h6 id="api-differences-29"><a class="doc-anchor" href="#api-differences-29">§</a>API Differences</h6>
|
||
<p>This is renamed to indicate that it returns a <code>bitvec</code> structure, rather
|
||
than an ordinary <code>Range</code>.</p>
|
||
<h6 id="notes-2"><a class="doc-anchor" href="#notes-2">§</a>Notes</h6>
|
||
<p><code>BitSlice</code> does define a <a href="struct.BitSlice.html#method.as_ptr_range" title="method common_base::bit_vec::prelude::BitSlice::as_ptr_range"><code>.as_ptr_range()</code></a>, which returns a
|
||
<code>Range<BitPtr></code>. <code>BitPtrRange</code> has additional capabilities that
|
||
<code>Range<*const T></code> and <code>Range<BitPtr></code> do not.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_mut_bitptr_range" class="method"><h4 class="code-header">pub fn <a href="#method.as_mut_bitptr_range" class="fn">as_mut_bitptr_range</a>(&mut self) -> <a class="struct" href="struct.BitPtrRange.html" title="struct common_base::bit_vec::prelude::BitPtrRange">BitPtrRange</a><Mut, T, O> <a href="#" class="tooltip" data-notable-ty="BitPtrRange<Mut, T, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Views the bit-slice as a half-open range of write-capable bit-pointers,
|
||
to its first bit <em>in</em> the bit-slice and the first bit <em>beyond</em> it.</p>
|
||
<h6 id="original-59"><a class="doc-anchor" href="#original-59">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range"><code>slice::as_mut_ptr_range</code></a></p>
|
||
<h6 id="api-differences-30"><a class="doc-anchor" href="#api-differences-30">§</a>API Differences</h6>
|
||
<p>This is renamed to indicate that it returns a <code>bitvec</code> structure, rather
|
||
than an ordinary <code>Range</code>.</p>
|
||
<h6 id="notes-3"><a class="doc-anchor" href="#notes-3">§</a>Notes</h6>
|
||
<p><code>BitSlice</code> does define a [<code>.as_mut_ptr_range()</code>], which returns a
|
||
<code>Range<BitPtr></code>. <code>BitPtrRange</code> has additional capabilities that
|
||
<code>Range<*mut T></code> and <code>Range<BitPtr></code> do not.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from_bitslice" class="method"><h4 class="code-header">pub fn <a href="#method.clone_from_bitslice" class="fn">clone_from_bitslice</a><T2, O2>(&mut self, src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)<div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Copies the bits from <code>src</code> into <code>self</code>.</p>
|
||
<p><code>self</code> and <code>src</code> must have the same length.</p>
|
||
<h6 id="performance-1"><a class="doc-anchor" href="#performance-1">§</a>Performance</h6>
|
||
<p>If <code>src</code> has the same type arguments as <code>self</code>, it will use the same
|
||
implementation as <a href="struct.BitSlice.html#method.copy_from_bitslice" title="method common_base::bit_vec::prelude::BitSlice::copy_from_bitslice"><code>.copy_from_bitslice()</code></a>; if you know that this will
|
||
always be the case, you should prefer to use that method directly.</p>
|
||
<p>Only <code>.copy_from_bitslice()</code> is <em>able</em> to perform acceleration; this
|
||
method is <em>always</em> required to perform a bit-by-bit crawl over both
|
||
bit-slices.</p>
|
||
<h6 id="original-60"><a class="doc-anchor" href="#original-60">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.clone_from_slice"><code>slice::clone_from_slice</code></a></p>
|
||
<h6 id="api-differences-31"><a class="doc-anchor" href="#api-differences-31">§</a>API Differences</h6>
|
||
<p>This is renamed to reflect that it copies from another bit-slice, not
|
||
from an element slice.</p>
|
||
<p>In order to support general usage, it allows <code>src</code> to have different
|
||
type parameters than <code>self</code>, at the cost of performance optimizations.</p>
|
||
<h6 id="panics-15"><a class="doc-anchor" href="#panics-15">§</a>Panics</h6>
|
||
<p>This panics if the two bit-slices have different lengths.</p>
|
||
<h6 id="examples-60"><a class="doc-anchor" href="#examples-60">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.copy_from_bitslice" class="method"><h4 class="code-header">pub fn <a href="#method.copy_from_bitslice" class="fn">copy_from_bitslice</a>(&mut self, src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)</h4></section></summary><div class="docblock"><p>Copies all bits from <code>src</code> into <code>self</code>, using batched acceleration when
|
||
possible.</p>
|
||
<p><code>self</code> and <code>src</code> must have the same length.</p>
|
||
<h6 id="original-61"><a class="doc-anchor" href="#original-61">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.copy_from_slice"><code>slice::copy_from_slice</code></a></p>
|
||
<h6 id="panics-16"><a class="doc-anchor" href="#panics-16">§</a>Panics</h6>
|
||
<p>This panics if the two bit-slices have different lengths.</p>
|
||
<h6 id="examples-61"><a class="doc-anchor" href="#examples-61">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.swap_with_bitslice" class="method"><h4 class="code-header">pub fn <a href="#method.swap_with_bitslice" class="fn">swap_with_bitslice</a><T2, O2>(&mut self, other: &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)<div class="where">where
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Swaps the contents of two bit-slices.</p>
|
||
<p><code>self</code> and <code>other</code> must have the same length.</p>
|
||
<h6 id="original-62"><a class="doc-anchor" href="#original-62">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.swap_with_slice"><code>slice::swap_with_slice</code></a></p>
|
||
<h6 id="api-differences-32"><a class="doc-anchor" href="#api-differences-32">§</a>API Differences</h6>
|
||
<p>This method is renamed, as it takes a bit-slice rather than an element
|
||
slice.</p>
|
||
<h6 id="panics-17"><a class="doc-anchor" href="#panics-17">§</a>Panics</h6>
|
||
<p>This panics if the two bit-slices have different lengths.</p>
|
||
<h6 id="examples-62"><a class="doc-anchor" href="#examples-62">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>one = [<span class="number">0xA5u8</span>, <span class="number">0x69</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>two = <span class="number">0x1234u16</span>;
|
||
<span class="kw">let </span>one_bits = one.view_bits_mut::<Msb0>();
|
||
<span class="kw">let </span>two_bits = two.view_bits_mut::<Lsb0>();
|
||
|
||
one_bits.swap_with_bitslice(two_bits);
|
||
|
||
<span class="macro">assert_eq!</span>(one, [<span class="number">0x2C</span>, <span class="number">0x48</span>]);
|
||
<span class="macro">assert_eq!</span>(two, <span class="number">0x96A5</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-4" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-4" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Extensions of standard APIs.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.set" class="method"><h4 class="code-header">pub fn <a href="#method.set" class="fn">set</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Writes a new value into a single bit.</p>
|
||
<p>This is the replacement for <code>*slice[index] = value;</code>, as <code>bitvec</code> is not
|
||
able to express that under the current <code>IndexMut</code> API signature.</p>
|
||
<h6 id="parameters-6"><a class="doc-anchor" href="#parameters-6">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>&mut self</code></li>
|
||
<li><code>index</code>: The bit-index to set. It must be in <code>0 .. self.len()</code>.</li>
|
||
<li><code>value</code>: The new bit-value to write into the bit at <code>index</code>.</li>
|
||
</ul>
|
||
<h6 id="panics-18"><a class="doc-anchor" href="#panics-18">§</a>Panics</h6>
|
||
<p>This panics if <code>index</code> is out of bounds.</p>
|
||
<h6 id="examples-63"><a class="doc-anchor" href="#examples-63">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">1</span>];
|
||
bits.set(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
bits.set(<span class="number">1</span>, <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.set_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.set_unchecked" class="fn">set_unchecked</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Writes a new value into a single bit, without bounds checking.</p>
|
||
<h6 id="parameters-7"><a class="doc-anchor" href="#parameters-7">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>&mut self</code></li>
|
||
<li><code>index</code>: The bit-index to set. It must be in <code>0 .. self.len()</code>.</li>
|
||
<li><code>value</code>: The new bit-value to write into the bit at <code>index</code>.</li>
|
||
</ul>
|
||
<h6 id="safety-7"><a class="doc-anchor" href="#safety-7">§</a>Safety</h6>
|
||
<p>You must ensure that <code>index</code> is in the range <code>0 .. self.len()</code>.</p>
|
||
<p>This performs bit-pointer offset arithmetic without doing any bounds
|
||
checks. If <code>index</code> is out of bounds, then this will issue an
|
||
out-of-bounds access and will trigger memory unsafety.</p>
|
||
<h6 id="examples-64"><a class="doc-anchor" href="#examples-64">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = <span class="number">0u8</span>;
|
||
<span class="kw">let </span>bits = <span class="kw-2">&mut </span>data.view_bits_mut::<Lsb0>()[.. <span class="number">2</span>];
|
||
<span class="macro">assert_eq!</span>(bits.len(), <span class="number">2</span>);
|
||
<span class="kw">unsafe </span>{
|
||
bits.set_unchecked(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(data, <span class="number">8</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.replace" class="method"><h4 class="code-header">pub fn <a href="#method.replace" class="fn">replace</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Writes a new value into a bit, and returns its previous value.</p>
|
||
<h6 id="panics-19"><a class="doc-anchor" href="#panics-19">§</a>Panics</h6>
|
||
<p>This panics if <code>index</code> is not less than <code>self.len()</code>.</p>
|
||
<h6 id="examples-65"><a class="doc-anchor" href="#examples-65">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>];
|
||
<span class="macro">assert!</span>(!bits.replace(<span class="number">0</span>, <span class="bool-val">true</span>));
|
||
<span class="macro">assert!</span>(bits[<span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.replace_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.replace_unchecked" class="fn">replace_unchecked</a>(&mut self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Writes a new value into a bit, returning the previous value, without
|
||
bounds checking.</p>
|
||
<h6 id="safety-8"><a class="doc-anchor" href="#safety-8">§</a>Safety</h6>
|
||
<p><code>index</code> must be less than <code>self.len()</code>.</p>
|
||
<h6 id="examples-66"><a class="doc-anchor" href="#examples-66">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="kw">let </span>old = <span class="kw">unsafe </span>{
|
||
<span class="kw">let </span>a = <span class="kw-2">&mut </span>bits[.. <span class="number">1</span>];
|
||
a.replace_unchecked(<span class="number">1</span>, <span class="bool-val">true</span>)
|
||
};
|
||
<span class="macro">assert!</span>(!old);
|
||
<span class="macro">assert!</span>(bits[<span class="number">1</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.swap_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.swap_unchecked" class="fn">swap_unchecked</a>(&mut self, a: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Swaps two bits in a bit-slice, without bounds checking.</p>
|
||
<p>See <a href="struct.BitSlice.html#method.swap" title="method common_base::bit_vec::prelude::BitSlice::swap"><code>.swap()</code></a> for documentation.</p>
|
||
<h6 id="safety-9"><a class="doc-anchor" href="#safety-9">§</a>Safety</h6>
|
||
<p>You must ensure that <code>a</code> and <code>b</code> are both in the range <code>0 .. self.len()</code>.</p>
|
||
<p>This method performs bit-pointer offset arithmetic without doing any
|
||
bounds checks. If <code>a</code> or <code>b</code> are out of bounds, then this will issue an
|
||
out-of-bounds access and will trigger memory unsafety.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked" class="fn">split_at_unchecked</a>(
|
||
&self,
|
||
mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||
) -> (&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>)</h4></section></summary><div class="docblock"><p>Splits a bit-slice at an index, without bounds checking.</p>
|
||
<p>See <a href="struct.BitSlice.html#method.split_at" title="method common_base::bit_vec::prelude::BitSlice::split_at"><code>.split_at()</code></a> for documentation.</p>
|
||
<h6 id="safety-10"><a class="doc-anchor" href="#safety-10">§</a>Safety</h6>
|
||
<p>You must ensure that <code>mid</code> is in the range <code>0 ..= self.len()</code>.</p>
|
||
<p>This method produces new bit-slice references. If <code>mid</code> is out of
|
||
bounds, its behavior is <strong>library-level</strong> undefined. You must
|
||
conservatively assume that an out-of-bounds split point produces
|
||
compiler-level UB.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_unchecked_mut" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked_mut" class="fn">split_at_unchecked_mut</a>(
|
||
&mut self,
|
||
mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||
) -> (&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>, &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Alias" title="type common_base::bit_vec::prelude::BitStore::Alias">Alias</a>, O>)</h4></section></summary><div class="docblock"><p>Splits a mutable bit-slice at an index, without bounds checking.</p>
|
||
<p>See <a href="struct.BitSlice.html#method.split_at_mut" title="method common_base::bit_vec::prelude::BitSlice::split_at_mut"><code>.split_at_mut()</code></a> for documentation.</p>
|
||
<h6 id="safety-11"><a class="doc-anchor" href="#safety-11">§</a>Safety</h6>
|
||
<p>You must ensure that <code>mid</code> is in the range <code>0 ..= self.len()</code>.</p>
|
||
<p>This method produces new bit-slice references. If <code>mid</code> is out of
|
||
bounds, its behavior is <strong>library-level</strong> undefined. You must
|
||
conservatively assume that an out-of-bounds split point produces
|
||
compiler-level UB.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.copy_within_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.copy_within_unchecked" class="fn">copy_within_unchecked</a><R>(&mut self, src: R, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)<div class="where">where
|
||
R: RangeExt<<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,</div></h4></section></summary><div class="docblock"><p>Copies bits from one region of the bit-slice to another region of
|
||
itself, without doing bounds checks.</p>
|
||
<p>The regions are allowed to overlap.</p>
|
||
<h6 id="parameters-8"><a class="doc-anchor" href="#parameters-8">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>&mut self</code></li>
|
||
<li><code>src</code>: The range within <code>self</code> from which to copy.</li>
|
||
<li><code>dst</code>: The starting index within <code>self</code> at which to paste.</li>
|
||
</ul>
|
||
<h6 id="effects"><a class="doc-anchor" href="#effects">§</a>Effects</h6>
|
||
<p><code>self[src]</code> is copied to <code>self[dest .. dest + src.len()]</code>. The bits of
|
||
<code>self[src]</code> are in an unspecified, but initialized, state.</p>
|
||
<h6 id="safety-12"><a class="doc-anchor" href="#safety-12">§</a>Safety</h6>
|
||
<p><code>src.end()</code> and <code>dest + src.len()</code> must be entirely within bounds.</p>
|
||
<h6 id="examples-67"><a class="doc-anchor" href="#examples-67">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>data = <span class="number">0b1011_0000u8</span>;
|
||
<span class="kw">let </span>bits = data.view_bits_mut::<Msb0>();
|
||
|
||
<span class="kw">unsafe </span>{
|
||
bits.copy_within_unchecked(.. <span class="number">4</span>, <span class="number">2</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(data, <span class="number">0b1010_1100</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-5" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-5" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Views of underlying memory.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bit_domain" class="method"><h4 class="code-header">pub fn <a href="#method.bit_domain" class="fn">bit_domain</a>(&self) -> BitDomain<'_, Const, T, O></h4></section></summary><div class="docblock"><p>Partitions a bit-slice into maybe-contended and known-uncontended parts.</p>
|
||
<p>The documentation of <code>BitDomain</code> goes into this in more detail. In
|
||
short, this produces a <code>&BitSlice</code> that is as large as possible without
|
||
requiring alias protection, as well as any bits that were not able to be
|
||
included in the unaliased bit-slice.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bit_domain_mut" class="method"><h4 class="code-header">pub fn <a href="#method.bit_domain_mut" class="fn">bit_domain_mut</a>(&mut self) -> BitDomain<'_, Mut, T, O></h4></section></summary><div class="docblock"><p>Partitions a mutable bit-slice into maybe-contended and
|
||
known-uncontended parts.</p>
|
||
<p>The documentation of <code>BitDomain</code> goes into this in more detail. In
|
||
short, this produces a <code>&mut BitSlice</code> that is as large as possible
|
||
without requiring alias protection, as well as any bits that were not
|
||
able to be included in the unaliased bit-slice.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.domain" class="method"><h4 class="code-header">pub fn <a href="#method.domain" class="fn">domain</a>(&self) -> Domain<'_, Const, T, O></h4></section></summary><div class="docblock"><p>Views the underlying memory of a bit-slice, removing alias protections
|
||
where possible.</p>
|
||
<p>The documentation of <code>Domain</code> goes into this in more detail. In short,
|
||
this produces a <code>&[T]</code> slice with alias protections removed, covering
|
||
all elements that <code>self</code> completely fills. Partially-used elements on
|
||
either the front or back edge of the slice are returned separately.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.domain_mut" class="method"><h4 class="code-header">pub fn <a href="#method.domain_mut" class="fn">domain_mut</a>(&mut self) -> Domain<'_, Mut, T, O></h4></section></summary><div class="docblock"><p>Views the underlying memory of a bit-slice, removing alias protections
|
||
where possible.</p>
|
||
<p>The documentation of <code>Domain</code> goes into this in more detail. In short,
|
||
this produces a <code>&mut [T]</code> slice with alias protections removed,
|
||
covering all elements that <code>self</code> completely fills. Partially-used
|
||
elements on the front or back edge of the slice are returned separately.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-6" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-6" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Bit-value queries.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.count_ones" class="method"><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/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits set to <code>1</code> in the bit-slice contents.</p>
|
||
<h6 id="examples-68"><a class="doc-anchor" href="#examples-68">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits[.. <span class="number">2</span>].count_ones(), <span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits[<span class="number">2 </span>..].count_ones(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].count_ones(), <span class="number">0</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.count_zeros" class="method"><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/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits cleared to <code>0</code> in the bit-slice contents.</p>
|
||
<h6 id="examples-69"><a class="doc-anchor" href="#examples-69">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>];
|
||
<span class="macro">assert_eq!</span>(bits[.. <span class="number">2</span>].count_zeros(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(bits[<span class="number">2 </span>..].count_zeros(), <span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].count_zeros(), <span class="number">0</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter_ones" class="method"><h4 class="code-header">pub fn <a href="#method.iter_ones" class="fn">iter_ones</a>(&self) -> IterOnes<'_, T, O></h4></section></summary><div class="docblock"><p>Enumerates the index of each bit in a bit-slice set to <code>1</code>.</p>
|
||
<p>This is a shorthand for a <code>.enumerate().filter_map()</code> iterator that
|
||
selects the index of each <code>true</code> bit; however, its implementation is
|
||
eligible for optimizations that the individual-bit iterator is not.</p>
|
||
<p>Specializations for the <code>Lsb0</code> and <code>Msb0</code> orderings allow processors
|
||
with instructions that seek particular bits within an element to operate
|
||
on whole elements, rather than on each bit individually.</p>
|
||
<h6 id="examples-70"><a class="doc-anchor" href="#examples-70">§</a>Examples</h6>
|
||
<p>This example uses <code>.iter_ones()</code>, a <code>.filter_map()</code> that finds the index
|
||
of each set bit, and the known indices, in order to show that they have
|
||
equivalent behavior.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
|
||
<span class="kw">let </span>iter_ones = bits.iter_ones();
|
||
<span class="kw">let </span>known_indices = [<span class="number">1</span>, <span class="number">4</span>, <span class="number">8</span>].iter().copied();
|
||
<span class="kw">let </span>filter = bits.iter()
|
||
.by_vals()
|
||
.enumerate()
|
||
.filter_map(|(idx, bit)| <span class="kw">if </span>bit { <span class="prelude-val">Some</span>(idx) } <span class="kw">else </span>{ <span class="prelude-val">None </span>});
|
||
<span class="kw">let </span>all = iter_ones.zip(known_indices).zip(filter);
|
||
|
||
<span class="kw">for </span>((iter_one, known), filtered) <span class="kw">in </span>all {
|
||
<span class="macro">assert_eq!</span>(iter_one, known);
|
||
<span class="macro">assert_eq!</span>(known, filtered);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter_zeros" class="method"><h4 class="code-header">pub fn <a href="#method.iter_zeros" class="fn">iter_zeros</a>(&self) -> IterZeros<'_, T, O></h4></section></summary><div class="docblock"><p>Enumerates the index of each bit in a bit-slice cleared to <code>0</code>.</p>
|
||
<p>This is a shorthand for a <code>.enumerate().filter_map()</code> iterator that
|
||
selects the index of each <code>false</code> bit; however, its implementation is
|
||
eligible for optimizations that the individual-bit iterator is not.</p>
|
||
<p>Specializations for the <code>Lsb0</code> and <code>Msb0</code> orderings allow processors
|
||
with instructions that seek particular bits within an element to operate
|
||
on whole elements, rather than on each bit individually.</p>
|
||
<h6 id="examples-71"><a class="doc-anchor" href="#examples-71">§</a>Examples</h6>
|
||
<p>This example uses <code>.iter_zeros()</code>, a <code>.filter_map()</code> that finds the
|
||
index of each cleared bit, and the known indices, in order to show that
|
||
they have equivalent behavior.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
|
||
<span class="kw">let </span>iter_zeros = bits.iter_zeros();
|
||
<span class="kw">let </span>known_indices = [<span class="number">1</span>, <span class="number">4</span>, <span class="number">8</span>].iter().copied();
|
||
<span class="kw">let </span>filter = bits.iter()
|
||
.by_vals()
|
||
.enumerate()
|
||
.filter_map(|(idx, bit)| <span class="kw">if </span>!bit { <span class="prelude-val">Some</span>(idx) } <span class="kw">else </span>{ <span class="prelude-val">None </span>});
|
||
<span class="kw">let </span>all = iter_zeros.zip(known_indices).zip(filter);
|
||
|
||
<span class="kw">for </span>((iter_zero, known), filtered) <span class="kw">in </span>all {
|
||
<span class="macro">assert_eq!</span>(iter_zero, known);
|
||
<span class="macro">assert_eq!</span>(known, filtered);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first_one" class="method"><h4 class="code-header">pub fn <a href="#method.first_one" class="fn">first_one</a>(&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/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Finds the index of the first bit in the bit-slice set to <code>1</code>.</p>
|
||
<p>Returns <code>None</code> if there is no <code>true</code> bit in the bit-slice.</p>
|
||
<h6 id="examples-72"><a class="doc-anchor" href="#examples-72">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].first_one().is_none());
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="number">0</span>].first_one().is_none());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].first_one(), <span class="prelude-val">Some</span>(<span class="number">1</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first_zero" class="method"><h4 class="code-header">pub fn <a href="#method.first_zero" class="fn">first_zero</a>(&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/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Finds the index of the first bit in the bit-slice cleared to <code>0</code>.</p>
|
||
<p>Returns <code>None</code> if there is no <code>false</code> bit in the bit-slice.</p>
|
||
<h6 id="examples-73"><a class="doc-anchor" href="#examples-73">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].first_zero().is_none());
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="number">1</span>].first_zero().is_none());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>].first_zero(), <span class="prelude-val">Some</span>(<span class="number">1</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last_one" class="method"><h4 class="code-header">pub fn <a href="#method.last_one" class="fn">last_one</a>(&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/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Finds the index of the last bit in the bit-slice set to <code>1</code>.</p>
|
||
<p>Returns <code>None</code> if there is no <code>true</code> bit in the bit-slice.</p>
|
||
<h6 id="examples-74"><a class="doc-anchor" href="#examples-74">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].last_one().is_none());
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="number">0</span>].last_one().is_none());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>].last_one(), <span class="prelude-val">Some</span>(<span class="number">0</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last_zero" class="method"><h4 class="code-header">pub fn <a href="#method.last_zero" class="fn">last_zero</a>(&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/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Finds the index of the last bit in the bit-slice cleared to <code>0</code>.</p>
|
||
<p>Returns <code>None</code> if there is no <code>false</code> bit in the bit-slice.</p>
|
||
<h6 id="examples-75"><a class="doc-anchor" href="#examples-75">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[].last_zero().is_none());
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="number">1</span>].last_zero().is_none());
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].last_zero(), <span class="prelude-val">Some</span>(<span class="number">0</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.leading_ones" class="method"><h4 class="code-header">pub fn <a href="#method.leading_ones" class="fn">leading_ones</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits from the start of the bit-slice to the first
|
||
bit set to <code>0</code>.</p>
|
||
<p>This returns <code>0</code> if the bit-slice is empty.</p>
|
||
<h6 id="examples-76"><a class="doc-anchor" href="#examples-76">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].leading_ones(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>].leading_ones(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>].leading_ones(), <span class="number">1</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.leading_zeros" class="method"><h4 class="code-header">pub fn <a href="#method.leading_zeros" class="fn">leading_zeros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits from the start of the bit-slice to the first
|
||
bit set to <code>1</code>.</p>
|
||
<p>This returns <code>0</code> if the bit-slice is empty.</p>
|
||
<h6 id="examples-77"><a class="doc-anchor" href="#examples-77">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].leading_zeros(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>].leading_zeros(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].leading_zeros(), <span class="number">1</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trailing_ones" class="method"><h4 class="code-header">pub fn <a href="#method.trailing_ones" class="fn">trailing_ones</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits from the end of the bit-slice to the last bit
|
||
set to <code>0</code>.</p>
|
||
<p>This returns <code>0</code> if the bit-slice is empty.</p>
|
||
<h6 id="examples-78"><a class="doc-anchor" href="#examples-78">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].trailing_ones(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>].trailing_ones(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].trailing_ones(), <span class="number">1</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.trailing_zeros" class="method"><h4 class="code-header">pub fn <a href="#method.trailing_zeros" class="fn">trailing_zeros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Counts the number of bits from the end of the bit-slice to the last bit
|
||
set to <code>1</code>.</p>
|
||
<p>This returns <code>0</code> if the bit-slice is empty.</p>
|
||
<h6 id="examples-79"><a class="doc-anchor" href="#examples-79">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[].trailing_zeros(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>].trailing_zeros(), <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>].trailing_zeros(), <span class="number">1</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.any" class="method"><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/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if there is at least one bit set to <code>1</code> in the bit-slice.</p>
|
||
<p>Returns <code>false</code> when <code>self</code> is empty.</p>
|
||
<h6 id="examples-80"><a class="doc-anchor" href="#examples-80">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[].any());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">0</span>].any());
|
||
<span class="macro">assert!</span>(<span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].any());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.all" class="method"><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/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if every bit is set to <code>1</code> in the bit-slice.</p>
|
||
<p>Returns <code>true</code> when <code>self</code> is empty.</p>
|
||
<h6 id="examples-81"><a class="doc-anchor" href="#examples-81">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[].all());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">0</span>].all());
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[<span class="number">1</span>].all());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.not_any" class="method"><h4 class="code-header">pub fn <a href="#method.not_any" class="fn">not_any</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if every bit is cleared to <code>0</code> in the bit-slice.</p>
|
||
<p>Returns <code>true</code> when <code>self</code> is empty.</p>
|
||
<h6 id="examples-82"><a class="doc-anchor" href="#examples-82">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[].not_any());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">1</span>].not_any());
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[<span class="number">0</span>].not_any());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.not_all" class="method"><h4 class="code-header">pub fn <a href="#method.not_all" class="fn">not_all</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if at least one bit is cleared to <code>0</code> in the bit-slice.</p>
|
||
<p>Returns <code>false</code> when <code>self</code> is empty.</p>
|
||
<h6 id="examples-83"><a class="doc-anchor" href="#examples-83">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[].not_all());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">1</span>].not_all());
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[<span class="number">0</span>].not_all());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.some" class="method"><h4 class="code-header">pub fn <a href="#method.some" class="fn">some</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Tests if at least one bit is set to <code>1</code>, and at least one bit is cleared
|
||
to <code>0</code>, in the bit-slice.</p>
|
||
<p>Returns <code>false</code> when <code>self</code> is empty.</p>
|
||
<h6 id="examples-84"><a class="doc-anchor" href="#examples-84">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[].some());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">0</span>].some());
|
||
<span class="macro">assert!</span>(!<span class="macro">bits!</span>[<span class="number">1</span>].some());
|
||
<span class="macro">assert!</span>( <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>].some());</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-7" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-7" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Buffer manipulation.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.shift_left" class="method"><h4 class="code-header">pub fn <a href="#method.shift_left" class="fn">shift_left</a>(&mut self, by: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shifts the contents of a bit-slice “left” (towards the zero-index),
|
||
clearing the “right” bits to <code>0</code>.</p>
|
||
<p>This is a strictly-worse analogue to taking <code>bits = &bits[by ..]</code>: it
|
||
has to modify the entire memory region that <code>bits</code> governs, and destroys
|
||
contained information. Unless the actual memory layout and contents of
|
||
your bit-slice matters to your program, you should <em>probably</em> prefer to
|
||
munch your way forward through a bit-slice handle.</p>
|
||
<p>Note also that the “left” here is semantic only, and <strong>does not</strong>
|
||
necessarily correspond to a left-shift instruction applied to the
|
||
underlying integer storage.</p>
|
||
<p>This has no effect when <code>by</code> is <code>0</code>. When <code>by</code> is <code>self.len()</code>, the
|
||
bit-slice is entirely cleared to <code>0</code>.</p>
|
||
<h6 id="panics-20"><a class="doc-anchor" href="#panics-20">§</a>Panics</h6>
|
||
<p>This panics if <code>by</code> is not less than <code>self.len()</code>.</p>
|
||
<h6 id="examples-85"><a class="doc-anchor" href="#examples-85">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="comment">// these bits are retained ^--------------------------^
|
||
</span>bits.shift_left(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>]);
|
||
<span class="comment">// and move here ^--------------------------^
|
||
|
||
</span><span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">1</span>; <span class="number">2</span>];
|
||
bits.shift_left(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.shift_right" class="method"><h4 class="code-header">pub fn <a href="#method.shift_right" class="fn">shift_right</a>(&mut self, by: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</h4></section></summary><div class="docblock"><p>Shifts the contents of a bit-slice “right” (away from the zero-index),
|
||
clearing the “left” bits to <code>0</code>.</p>
|
||
<p>This is a strictly-worse analogue to taking `bits = &bits[.. bits.len()</p>
|
||
<ul>
|
||
<li>by]<code>: it must modify the entire memory region that </code>bits` governs, and
|
||
destroys contained information. Unless the actual memory layout and
|
||
contents of your bit-slice matters to your program, you should
|
||
<em>probably</em> prefer to munch your way backward through a bit-slice handle.</li>
|
||
</ul>
|
||
<p>Note also that the “right” here is semantic only, and <strong>does not</strong>
|
||
necessarily correspond to a right-shift instruction applied to the
|
||
underlying integer storage.</p>
|
||
<p>This has no effect when <code>by</code> is <code>0</code>. When <code>by</code> is <code>self.len()</code>, the
|
||
bit-slice is entirely cleared to <code>0</code>.</p>
|
||
<h6 id="panics-21"><a class="doc-anchor" href="#panics-21">§</a>Panics</h6>
|
||
<p>This panics if <code>by</code> is not less than <code>self.len()</code>.</p>
|
||
<h6 id="examples-86"><a class="doc-anchor" href="#examples-86">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="comment">// these bits stay ^--------------------------^
|
||
</span>bits.shift_right(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>]);
|
||
<span class="comment">// and move here ^--------------------------^
|
||
|
||
</span><span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">1</span>; <span class="number">2</span>];
|
||
bits.shift_right(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">0</span>; <span class="number">2</span>]);</code></pre></div></div></details></div></details><section id="impl-BitSlice%3CT,+O%3E-8" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-8" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="item-info"><div class="stab empty-impl">This impl block contains no items.</div></div><div class="docblock"><p>Crate internals.</p>
|
||
</div></section><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-9" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-9" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a> + Radium,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Methods available only when <code>T</code> allows shared mutability.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.set_aliased" class="method"><h4 class="code-header">pub fn <a href="#method.set_aliased" class="fn">set_aliased</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Writes a new value into a single bit, using alias-safe operations.</p>
|
||
<p>This is equivalent to <a href="struct.BitSlice.html#method.set" title="method common_base::bit_vec::prelude::BitSlice::set"><code>.set()</code></a>, except that it does not require an
|
||
<code>&mut</code> reference, and allows bit-slices with alias-safe storage to share
|
||
write permissions.</p>
|
||
<h6 id="parameters-9"><a class="doc-anchor" href="#parameters-9">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>&self</code>: This method only exists on bit-slices with alias-safe
|
||
storage, and so does not require exclusive access.</li>
|
||
<li><code>index</code>: The bit index to set. It must be in <code>0 .. self.len()</code>.</li>
|
||
<li><code>value</code>: The new bit-value to write into the bit at <code>index</code>.</li>
|
||
</ul>
|
||
<h6 id="panics-22"><a class="doc-anchor" href="#panics-22">§</a>Panics</h6>
|
||
<p>This panics if <code>index</code> is out of bounds.</p>
|
||
<h6 id="examples-87"><a class="doc-anchor" href="#examples-87">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">use </span>core::cell::Cell;
|
||
|
||
<span class="kw">let </span>bits: <span class="kw-2">&</span>BitSlice<<span class="kw">_</span>, <span class="kw">_</span>> = <span class="macro">bits!</span>[Cell<usize>, Lsb0; <span class="number">0</span>, <span class="number">1</span>];
|
||
bits.set_aliased(<span class="number">0</span>, <span class="bool-val">true</span>);
|
||
bits.set_aliased(<span class="number">1</span>, <span class="bool-val">false</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(bits, <span class="macro">bits!</span>[<span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.set_aliased_unchecked" class="method"><h4 class="code-header">pub unsafe fn <a href="#method.set_aliased_unchecked" class="fn">set_aliased_unchecked</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</h4></section></summary><div class="docblock"><p>Writes a new value into a single bit, using alias-safe operations and
|
||
without bounds checking.</p>
|
||
<p>This is equivalent to <a href="struct.BitSlice.html#method.set_unchecked" title="method common_base::bit_vec::prelude::BitSlice::set_unchecked"><code>.set_unchecked()</code></a>, except that it does not
|
||
require an <code>&mut</code> reference, and allows bit-slices with alias-safe
|
||
storage to share write permissions.</p>
|
||
<h6 id="parameters-10"><a class="doc-anchor" href="#parameters-10">§</a>Parameters</h6>
|
||
<ul>
|
||
<li><code>&self</code>: This method only exists on bit-slices with alias-safe
|
||
storage, and so does not require exclusive access.</li>
|
||
<li><code>index</code>: The bit index to set. It must be in <code>0 .. self.len()</code>.</li>
|
||
<li><code>value</code>: The new bit-value to write into the bit at <code>index</code>.</li>
|
||
</ul>
|
||
<h6 id="safety-13"><a class="doc-anchor" href="#safety-13">§</a>Safety</h6>
|
||
<p>The caller must ensure that <code>index</code> is not out of bounds.</p>
|
||
<h6 id="examples-88"><a class="doc-anchor" href="#examples-88">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
<span class="kw">use </span>core::cell::Cell;
|
||
|
||
<span class="kw">let </span>data = Cell::new(<span class="number">0u8</span>);
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Lsb0>()[.. <span class="number">2</span>];
|
||
<span class="kw">unsafe </span>{
|
||
bits.set_aliased_unchecked(<span class="number">3</span>, <span class="bool-val">true</span>);
|
||
}
|
||
<span class="macro">assert_eq!</span>(data.get(), <span class="number">8</span>);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-10" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-10" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Miscellaneous information.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.MAX_BITS" class="associatedconstant"><h4 class="code-header">pub const <a href="#associatedconstant.MAX_BITS" class="constant">MAX_BITS</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = 2_305_843_009_213_693_951usize</h4></section></summary><div class="docblock"><p>The inclusive maximum length of a <code>BitSlice<_, T></code>.</p>
|
||
<p>As <code>BitSlice</code> is zero-indexed, the largest possible <em>index</em> is one less
|
||
than this value.</p>
|
||
<div><table><thead><tr><th style="text-align: right">CPU word width</th><th style="text-align: right">Value</th></tr></thead><tbody>
|
||
<tr><td style="text-align: right">32 bits</td><td style="text-align: right"><code>0x1fff_ffff</code></td></tr>
|
||
<tr><td style="text-align: right">64 bits</td><td style="text-align: right"><code>0x1fff_ffff_ffff_ffff</code></td></tr>
|
||
</tbody></table>
|
||
</div></div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_ELTS" class="associatedconstant"><h4 class="code-header">pub const <a href="#associatedconstant.MAX_ELTS" class="constant">MAX_ELTS</a>: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> = BitSpan<Const, T, O>::REGION_MAX_ELTS</h4></section></summary><div class="docblock"><p>The inclusive maximum length that a <code>[T]</code> slice can be for
|
||
<code>BitSlice<_, T></code> to cover it.</p>
|
||
<p>A <code>BitSlice<_, T></code> that begins in the interior of an element and
|
||
contains the maximum number of bits will extend one element past the
|
||
cutoff that would occur if the bit-slice began at the zeroth bit. Such a
|
||
bit-slice is difficult to manually construct, but would not otherwise
|
||
fail.</p>
|
||
<div><table><thead><tr><th style="text-align: right">Type Bits</th><th style="text-align: right">Max Elements (32-bit)</th><th style="text-align: right">Max Elements (64-bit)</th></tr></thead><tbody>
|
||
<tr><td style="text-align: right">8</td><td style="text-align: right"><code>0x0400_0001</code></td><td style="text-align: right"><code>0x0400_0000_0000_0001</code></td></tr>
|
||
<tr><td style="text-align: right">16</td><td style="text-align: right"><code>0x0200_0001</code></td><td style="text-align: right"><code>0x0200_0000_0000_0001</code></td></tr>
|
||
<tr><td style="text-align: right">32</td><td style="text-align: right"><code>0x0100_0001</code></td><td style="text-align: right"><code>0x0100_0000_0000_0001</code></td></tr>
|
||
<tr><td style="text-align: right">64</td><td style="text-align: right"><code>0x0080_0001</code></td><td style="text-align: right"><code>0x0080_0000_0000_0001</code></td></tr>
|
||
</tbody></table>
|
||
</div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitSlice%3CT,+O%3E-11" class="impl"><a href="#impl-BitSlice%3CT,+O%3E-11" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_bitvec" class="method"><h4 class="code-header">pub fn <a href="#method.to_bitvec" class="fn">to_bitvec</a>(&self) -> <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><<T as <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>>::<a class="associatedtype" href="trait.BitStore.html#associatedtype.Unalias" title="type common_base::bit_vec::prelude::BitStore::Unalias">Unalias</a>, O> <a href="#" class="tooltip" data-notable-ty="BitVec<<T as BitStore>::Unalias, O>">ⓘ</a></h4></section></summary><div class="docblock"><p>Copies a bit-slice into an owned bit-vector.</p>
|
||
<p>Since the new vector is freshly owned, this gets marked as <code>::Unalias</code>
|
||
to remove any guards that may have been inserted by the bit-slice’s
|
||
history.</p>
|
||
<p>It does <em>not</em> use the underlying memory type, so that a <code>BitSlice<_, Cell<_>></code> will produce a <code>BitVec<_, Cell<_>></code>.</p>
|
||
<h6 id="original-63"><a class="doc-anchor" href="#original-63">§</a>Original</h6>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.to_vec"><code>slice::to_vec</code></a></p>
|
||
<h6 id="examples-89"><a class="doc-anchor" href="#examples-89">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>bv = bits.to_bitvec();
|
||
<span class="macro">assert_eq!</span>(bits, bv);</code></pre></div></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-AsMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="impl"><a href="#impl-AsMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut" class="method trait-impl"><a href="#method.as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&mut self) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<<A as BitView>::Store, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="impl"><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut-1" class="method trait-impl"><a href="#method.as_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&mut self) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-AsMut%3C%5BT%5D%3E">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut-2" class="method trait-impl"><a href="#method.as_mut-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&mut self) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-AsMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut-3" class="method trait-impl"><a href="#method.as_mut-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&mut self) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="impl"><a href="#impl-AsRef%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<<A as BitView>::Store, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="impl"><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-1" class="method trait-impl"><a href="#method.as_ref-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-AsRef%3C%5BT%5D%3E">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-2" class="method trait-impl"><a href="#method.as_ref-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-AsRef%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-3" class="method trait-impl"><a href="#method.as_ref-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Binary-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Binary-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.html" title="trait core::fmt::Binary">Binary</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-rendering"><a class="doc-anchor" href="#bit-slice-rendering">§</a>Bit-Slice Rendering</h4>
|
||
<p>This implementation prints the contents of a <code>&BitSlice</code> in one of binary,
|
||
octal, or hexadecimal. It is important to note that this does <em>not</em> render the
|
||
raw underlying memory! They render the semantically-ordered contents of the
|
||
bit-slice as numerals. This distinction matters if you use type parameters that
|
||
differ from those presumed by your debugger (which is usually <code><u8, Msb0></code>).</p>
|
||
</div></section></summary><div class="docblock"><p>The output separates the <code>T</code> elements as individual list items, and renders each
|
||
element as a base- 2, 8, or 16 numeric string. When walking an element, the bits
|
||
traversed by the bit-slice are considered to be stored in
|
||
most-significant-bit-first ordering. This means that index <code>[0]</code> is the high bit
|
||
of the left-most digit, and index <code>[n]</code> is the low bit of the right-most digit,
|
||
in a given printed word.</p>
|
||
<p>In order to render according to expectations of the Arabic numeral system, an
|
||
element being transcribed is chunked into digits from the least-significant end
|
||
of its rendered form. This is most noticeable in octal, which will always have a
|
||
smaller ceiling on the left-most digit in a printed word, while the right-most
|
||
digit in that word is able to use the full <code>0 ..= 7</code> numeral range.</p>
|
||
<h5 id="examples-94"><a class="doc-anchor" href="#examples-94">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [
|
||
<span class="number">0b000000_10u8</span>,
|
||
<span class="comment">// digits print LTR
|
||
</span><span class="number">0b10_001_101</span>,
|
||
<span class="comment">// significance is computed RTL
|
||
</span><span class="number">0b01_000000</span>,
|
||
];
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Msb0>()[<span class="number">6 </span>.. <span class="number">18</span>];
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:b}"</span>, bits), <span class="string">"[10, 10001101, 01]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:o}"</span>, bits), <span class="string">"[2, 215, 1]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:X}"</span>, bits), <span class="string">"[2, 8D, 1]"</span>);</code></pre></div>
|
||
<p>The <code>{:#}</code> format modifier causes the standard <code>0b</code>, <code>0o</code>, or <code>0x</code> prefix to be
|
||
applied to each printed word. The other format specifiers are not interpreted by
|
||
this implementation, and apply to the entire rendered text, not to individual
|
||
words.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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.Binary.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitAndAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><&<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-1" class="method trait-impl"><a href="#method.bitand_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitAndAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><&<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-3" class="method trait-impl"><a href="#method.bitand_assign-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-BitAndAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-4" class="method trait-impl"><a href="#method.bitand_assign-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)</h4></section></summary><div class="docblock"><h5 id="boolean-arithmetic"><a class="doc-anchor" href="#boolean-arithmetic">§</a>Boolean Arithmetic</h5>
|
||
<p>This merges another bit-slice into <code>self</code> with a Boolean arithmetic operation.
|
||
If the other bit-slice is shorter than <code>self</code>, it is zero-extended. For <code>BitAnd</code>,
|
||
this clears all excess bits of <code>self</code> to <code>0</code>; for <code>BitOr</code> and <code>BitXor</code>, it
|
||
leaves them untouched</p>
|
||
<h6 id="behavior-1"><a class="doc-anchor" href="#behavior-1">§</a>Behavior</h6>
|
||
<p>The Boolean operation proceeds across each bit-slice in iteration order. This is
|
||
<code>3O(n)</code> in the length of the shorter of <code>self</code> and <code>rhs</code>. However, it can be
|
||
accelerated if <code>rhs</code> has the same type parameters as <code>self</code>, and both are using
|
||
one of the orderings provided by <code>bitvec</code>. In this case, the implementation
|
||
specializes to use <code>BitField</code> batch operations to operate on the slices one word
|
||
at a time, rather than one bit.</p>
|
||
<p>Acceleration is not currently provided for custom bit-orderings that use the
|
||
same storage type.</p>
|
||
<h6 id="pre-10-behavior"><a class="doc-anchor" href="#pre-10-behavior">§</a>Pre-<code>1.0</code> Behavior</h6>
|
||
<p>In the <code>0.</code> development series, Boolean arithmetic was implemented against all
|
||
<code>I: Iterator<Item = bool></code>. This allowed code such as <code>bits |= [false, true];</code>,
|
||
but forbad acceleration in the most common use case (combining two bit-slices)
|
||
because <code>BitSlice</code> is not such an iterator.</p>
|
||
<p>Usage surveys indicate that it is better for the arithmetic operators to operate
|
||
on bit-slices, and to allow the possibility of specialized acceleration, rather
|
||
than to allow folding against any iterator of <code>bool</code>s.</p>
|
||
<p>If pre-<code>1.0</code> code relies on this behavior specifically, and has non-<code>BitSlice</code>
|
||
arguments to the Boolean sigils, then they will need to be replaced with the
|
||
equivalent loop.</p>
|
||
<h6 id="examples-90"><a class="doc-anchor" href="#examples-90">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>a = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>b = <span class="macro">bits!</span>[ <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
|
||
<span class="kw-2">*</span>a ^= b;
|
||
<span class="macro">assert_eq!</span>(a, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);
|
||
|
||
<span class="kw">let </span>c = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>d = [<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="comment">// no longer allowed
|
||
// c &= d.into_iter().by_vals();
|
||
</span><span class="kw">for </span>(<span class="kw-2">mut </span>c, d) <span class="kw">in </span>c.iter_mut().zip(d.into_iter())
|
||
{
|
||
<span class="kw-2">*</span>c ^= d;
|
||
}
|
||
<span class="macro">assert_eq!</span>(c, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitAndAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><&<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-6" class="method trait-impl"><a href="#method.bitand_assign-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitAndAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign" class="method trait-impl"><a href="#method.bitand_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitAndAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-2" class="method trait-impl"><a href="#method.bitand_assign-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitAndAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitAndAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html" title="trait core::ops::bit::BitAndAssign">BitAndAssign</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitand_assign-5" class="method trait-impl"><a href="#method.bitand_assign-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign" class="fn">bitand_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>&=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitAndAssign.html#tymethod.bitand_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitField-for-BitSlice%3CT%3E" class="impl"><a href="#impl-BitField-for-BitSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitField</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3><div class="docblock"><h4 id="lsb0-bit-field-behavior"><a class="doc-anchor" href="#lsb0-bit-field-behavior">§</a><code>Lsb0</code> Bit-Field Behavior</h4>
|
||
<p><code>BitField</code> has no requirements about the in-memory representation or layout of
|
||
stored integers within a bit-slice, only that round-tripping an integer through
|
||
a store and a load of the same element suffix on the same bit-slice is
|
||
idempotent (with respect to sign truncation).</p>
|
||
</div></section></summary><div class="docblock"><p><code>Lsb0</code> provides a contiguous translation from bit-index to real memory: for any
|
||
given bit index <code>n</code> and its position <code>P(n)</code>, <code>P(n + 1)</code> is <code>P(n) + 1</code>. This
|
||
allows it to provide batched behavior: since the section of contiguous indices
|
||
used within an element translates to a section of contiguous bits in real
|
||
memory, the transaction is always a single shift/mask operation.</p>
|
||
<p>Each implemented method contains documentation and examples showing exactly how
|
||
the abstract integer space is mapped to real memory.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.load_le" class="method trait-impl"><a href="#method.load_le" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.load_le" class="fn">load_le</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="lsb0-little-endian-integer-loading"><a class="doc-anchor" href="#lsb0-little-endian-integer-loading">§</a><code>Lsb0</code> Little-Endian Integer Loading</h5>
|
||
<p>This implementation uses the <code>Lsb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element contain the contents of an integer to be
|
||
loaded, using little-endian element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.load_le" title="method common_base::bit_vec::prelude::_::load_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="signed-integer-loading"><a class="doc-anchor" href="#signed-integer-loading">§</a>Signed-Integer Loading</h6>
|
||
<p>As described in the trait definition, when loading as a signed integer, the most
|
||
significant bit <em>loaded</em> from memory is sign-extended to the full width of the
|
||
returned type. In this method, that means the most-significant loaded bit of the
|
||
final element.</p>
|
||
<h6 id="examples-98"><a class="doc-anchor" href="#examples-98">§</a>Examples</h6>
|
||
<p>In each memory element, the <code>Lsb0</code> ordering counts indices leftward from the
|
||
right edge:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = <span class="number">0b00_10110_0u8</span>;
|
||
<span class="comment">// 76 54321 0
|
||
// ^ sign bit
|
||
</span><span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.load_le::<u8>(),
|
||
<span class="number">0b000_10110</span>,
|
||
);
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.load_le::<i8>(),
|
||
<span class="number">0b111_10110u8 </span><span class="kw">as </span>i8,
|
||
);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the little-endian element ordering
|
||
means that the slice index increases with numerical significance:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = [
|
||
<span class="number">0x8_Fu8</span>,
|
||
<span class="comment">// 7 0
|
||
</span><span class="number">0x0_1u8</span>,
|
||
<span class="comment">// 15 8
|
||
</span><span class="number">0b1111_0010u8</span>,
|
||
<span class="comment">// ^ sign bit
|
||
// 23 16
|
||
</span>];
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.load_le::<u16>(),
|
||
<span class="number">0x2018u16</span>,
|
||
);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and load functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.load_be" class="method trait-impl"><a href="#method.load_be" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.load_be" class="fn">load_be</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="lsb0-big-endian-integer-loading"><a class="doc-anchor" href="#lsb0-big-endian-integer-loading">§</a><code>Lsb0</code> Big-Endian Integer Loading</h5>
|
||
<p>This implementation uses the <code>Lsb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element contain the contents of an integer to be
|
||
loaded, using big-endian element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.load_le" title="method common_base::bit_vec::prelude::_::load_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="signed-integer-loading-1"><a class="doc-anchor" href="#signed-integer-loading-1">§</a>Signed-Integer Loading</h6>
|
||
<p>As described in the trait definition, when loading as a signed integer, the most
|
||
significant bit <em>loaded</em> from memory is sign-extended to the full width of the
|
||
returned type. In this method, that means that the most-significant bit of the
|
||
first element.</p>
|
||
<h6 id="examples-99"><a class="doc-anchor" href="#examples-99">§</a>Examples</h6>
|
||
<p>In each memory element, the <code>Lsb0</code> ordering counts indices leftward from the
|
||
right edge:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = <span class="number">0b00_10110_0u8</span>;
|
||
<span class="comment">// 76 54321 0
|
||
// ^ sign bit
|
||
</span><span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.load_be::<u8>(),
|
||
<span class="number">0b000_10110</span>,
|
||
);
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.load_be::<i8>(),
|
||
<span class="number">0b111_10110u8 </span><span class="kw">as </span>i8,
|
||
);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the big-endian element ordering means
|
||
that the slice index increases while numeric significance decreases:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = [
|
||
<span class="number">0b0010_1111u8</span>,
|
||
<span class="comment">// ^ sign bit
|
||
// 7 0
|
||
</span><span class="number">0x0_1u8</span>,
|
||
<span class="comment">// 15 8
|
||
</span><span class="number">0xF_8u8</span>,
|
||
<span class="comment">// 23 16
|
||
</span>];
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Lsb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.load_be::<u16>(),
|
||
<span class="number">0x2018u16</span>,
|
||
);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and load functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.store_le" class="method trait-impl"><a href="#method.store_le" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.store_le" class="fn">store_le</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="lsb0-little-endian-integer-storing"><a class="doc-anchor" href="#lsb0-little-endian-integer-storing">§</a><code>Lsb0</code> Little-Endian Integer Storing</h5>
|
||
<p>This implementation uses the <code>Lsb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element are used for storage, using little-endian
|
||
element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.store_le" title="method common_base::bit_vec::prelude::_::store_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="narrowing-behavior"><a class="doc-anchor" href="#narrowing-behavior">§</a>Narrowing Behavior</h6>
|
||
<p>Integers are truncated from the high end. When storing into a bit-slice of
|
||
length <code>n</code>, the <code>n</code> least numerically significant bits are stored, and any
|
||
remaining high bits are ignored.</p>
|
||
<p>Be aware of this behavior if you are storing signed integers! The signed integer
|
||
<code>-14i8</code> (bit pattern <code>0b1111_0010u8</code>) will, when stored into and loaded back
|
||
from a 4-bit slice, become the value <code>2i8</code>.</p>
|
||
<h6 id="examples-100"><a class="doc-anchor" href="#examples-100">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = <span class="number">0u8</span>;
|
||
raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.store_le(<span class="number">22u8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);
|
||
<span class="comment">// 76 54321 0
|
||
</span>raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.store_le(-<span class="number">10i8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the little-endian element ordering
|
||
means that the slice index increases with numerical significance:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = [!<span class="number">0u8</span>; <span class="number">3</span>];
|
||
raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.store_le(<span class="number">0x2018u16</span>);
|
||
<span class="macro">assert_eq!</span>(raw, [
|
||
<span class="number">0x8_F</span>,
|
||
<span class="comment">// 7 0
|
||
</span><span class="number">0x0_1</span>,
|
||
<span class="comment">// 15 8
|
||
</span><span class="number">0xF_2</span>,
|
||
<span class="comment">// 23 16
|
||
</span>]);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and store functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.store_be" class="method trait-impl"><a href="#method.store_be" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.store_be" class="fn">store_be</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="lsb0-big-endian-integer-storing"><a class="doc-anchor" href="#lsb0-big-endian-integer-storing">§</a><code>Lsb0</code> Big-Endian Integer Storing</h5>
|
||
<p>This implementation uses the <code>Lsb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element are used for storage, using big-endian element
|
||
ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.store_be" title="method common_base::bit_vec::prelude::_::store_be">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="narrowing-behavior-1"><a class="doc-anchor" href="#narrowing-behavior-1">§</a>Narrowing Behavior</h6>
|
||
<p>Integers are truncated from the high end. When storing into a bit-slice of
|
||
length <code>n</code>, the <code>n</code> least numerically significant bits are stored, and any
|
||
remaining high bits are ignored.</p>
|
||
<p>Be aware of this behavior if you are storing signed integers! The signed integer
|
||
<code>-14i8</code> (bit pattern <code>0b1111_0010u8</code>) will, when stored into and loaded back
|
||
from a 4-bit slice, become the value <code>2i8</code>.</p>
|
||
<h6 id="examples-101"><a class="doc-anchor" href="#examples-101">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = <span class="number">0u8</span>;
|
||
raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.store_be(<span class="number">22u8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);
|
||
<span class="comment">// 76 54321 0
|
||
</span>raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">1 </span>.. <span class="number">6</span>]
|
||
.store_be(-<span class="number">10i8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the big-endian element ordering means
|
||
that the slice index increases while numerical significance decreases:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = [!<span class="number">0u8</span>; <span class="number">3</span>];
|
||
raw.view_bits_mut::<Lsb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.store_be(<span class="number">0x2018u16</span>);
|
||
<span class="macro">assert_eq!</span>(raw, [
|
||
<span class="number">0x2_F</span>,
|
||
<span class="comment">// 7 0
|
||
</span><span class="number">0x0_1</span>,
|
||
<span class="comment">// 15 8
|
||
</span><span class="number">0xF_8</span>,
|
||
<span class="comment">// 23 16
|
||
</span>]);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and store functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.load" class="method trait-impl"><a href="#method.load" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#method.load" class="fn">load</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class='docblock'>Integer Loading <a href="trait._.html#method.load">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.store" class="method trait-impl"><a href="#method.store" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#method.store" class="fn">store</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class='docblock'>Integer Storing <a href="trait._.html#method.store">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitField-for-BitSlice%3CT,+Msb0%3E" class="impl"><a href="#impl-BitField-for-BitSlice%3CT,+Msb0%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitField</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, <a class="struct" href="struct.Msb0.html" title="struct common_base::bit_vec::prelude::Msb0">Msb0</a>><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3><div class="docblock"><h4 id="msb0-bit-field-behavior"><a class="doc-anchor" href="#msb0-bit-field-behavior">§</a><code>Msb0</code> Bit-Field Behavior</h4>
|
||
<p><code>BitField</code> has no requirements about the in-memory representation or layout of
|
||
stored integers within a bit-slice, only that round-tripping an integer through
|
||
a store and a load of the same element suffix on the same bit-slice is
|
||
idempotent (with respect to sign truncation).</p>
|
||
</div></section></summary><div class="docblock"><p><code>Msb0</code> provides a contiguous translation from bit-index to real memory: for any
|
||
given bit index <code>n</code> and its position <code>P(n)</code>, <code>P(n + 1)</code> is <code>P(n) - 1</code>. This
|
||
allows it to provide batched behavior: since the section of contiguous indices
|
||
used within an element translates to a section of contiguous bits in real
|
||
memory, the transaction is always a single shift-mask operation.</p>
|
||
<p>Each implemented method contains documentation and examples showing exactly how
|
||
the abstract integer space is mapped to real memory.</p>
|
||
<h5 id="notes-4"><a class="doc-anchor" href="#notes-4">§</a>Notes</h5>
|
||
<p>In particular, note that while <code>Msb0</code> indexes bits from the most significant
|
||
down to the least, and integers index from the least up to the most, this
|
||
<strong>does not</strong> reörder any bits of the integer value! This ordering only finds a
|
||
region in real memory; it does <em>not</em> affect the partial-integer contents stored
|
||
in that region.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.load_le-1" class="method trait-impl"><a href="#method.load_le-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.load_le" class="fn">load_le</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="msb0-little-endian-integer-loading"><a class="doc-anchor" href="#msb0-little-endian-integer-loading">§</a><code>Msb0</code> Little-Endian Integer Loading</h5>
|
||
<p>This implementation uses the <code>Msb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element contain the contents of an integer to be
|
||
loaded, using little-endian element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.load_le" title="method common_base::bit_vec::prelude::_::load_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="signed-integer-loading-2"><a class="doc-anchor" href="#signed-integer-loading-2">§</a>Signed-Integer Loading</h6>
|
||
<p>As described in the trait definition, when loading as a signed integer, the most
|
||
significant bit <em>loaded</em> from memory is sign-extended to the full width of the
|
||
returned type. In this method, that means the most-significant loaded bit of the
|
||
final element.</p>
|
||
<h6 id="examples-102"><a class="doc-anchor" href="#examples-102">§</a>Examples</h6>
|
||
<p>In each memory element, the <code>Msb0</code> ordering counts indices rightward from the
|
||
left edge:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = <span class="number">0b00_10110_0u8</span>;
|
||
<span class="comment">// 01 23456 7
|
||
// ^ sign bit
|
||
</span><span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.load_le::<u8>(),
|
||
<span class="number">0b000_10110</span>,
|
||
);
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.load_le::<i8>(),
|
||
<span class="number">0b111_10110u8 </span><span class="kw">as </span>i8,
|
||
);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the little-endian element ordering
|
||
means that the slice index increases with numerical significance:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = [
|
||
<span class="number">0xF_8u8</span>,
|
||
<span class="comment">// 0 7
|
||
</span><span class="number">0x0_1u8</span>,
|
||
<span class="comment">// 8 15
|
||
</span><span class="number">0b0010_1111u8</span>,
|
||
<span class="comment">// ^ sign bit
|
||
// 16 23
|
||
</span>];
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.load_le::<u16>(),
|
||
<span class="number">0x2018u16</span>,
|
||
);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and load functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.load_be-1" class="method trait-impl"><a href="#method.load_be-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.load_be" class="fn">load_be</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="msb0-big-endian-integer-loading"><a class="doc-anchor" href="#msb0-big-endian-integer-loading">§</a><code>Msb0</code> Big-Endian Integer Loading</h5>
|
||
<p>This implementation uses the <code>Msb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element contain the contents of an integer to be
|
||
loaded, using big-endian element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.load_le" title="method common_base::bit_vec::prelude::_::load_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="signed-integer-loading-3"><a class="doc-anchor" href="#signed-integer-loading-3">§</a>Signed-Integer Loading</h6>
|
||
<p>As described in the trait definition, when loading as a signed integer, the most
|
||
significant bit <em>loaded</em> from memory is sign-extended to the full width of the
|
||
returned type. In this method, that means the most-significant loaded bit of the
|
||
first element.</p>
|
||
<h6 id="examples-103"><a class="doc-anchor" href="#examples-103">§</a>Examples</h6>
|
||
<p>In each memory element, the <code>Msb0</code> ordering counts indices rightward from the
|
||
left edge:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = <span class="number">0b00_10110_0u8</span>;
|
||
<span class="comment">// 01 23456 7
|
||
// ^ sign bit
|
||
</span><span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.load_be::<u8>(),
|
||
<span class="number">0b000_10110</span>,
|
||
);
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.load_be::<i8>(),
|
||
<span class="number">0b111_10110u8 </span><span class="kw">as </span>i8,
|
||
);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the big-endian element ordering means
|
||
that the slice index increases with numerical significance:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>raw = [
|
||
<span class="number">0b1111_0010u8</span>,
|
||
<span class="comment">// ^ sign bit
|
||
// 0 7
|
||
</span><span class="number">0x0_1u8</span>,
|
||
<span class="comment">// 8 15
|
||
</span><span class="number">0x8_Fu8</span>,
|
||
<span class="comment">// 16 23
|
||
</span>];
|
||
<span class="macro">assert_eq!</span>(
|
||
raw.view_bits::<Msb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.load_be::<u16>(),
|
||
<span class="number">0x2018u16</span>,
|
||
);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and load functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.store_le-1" class="method trait-impl"><a href="#method.store_le-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.store_le" class="fn">store_le</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="msb0-little-endian-integer-storing"><a class="doc-anchor" href="#msb0-little-endian-integer-storing">§</a><code>Msb0</code> Little-Endian Integer Storing</h5>
|
||
<p>This implementation uses the <code>Msb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element are used for storage, using little-endian
|
||
element ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.store_le" title="method common_base::bit_vec::prelude::_::store_le">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="narrowing-behavior-2"><a class="doc-anchor" href="#narrowing-behavior-2">§</a>Narrowing Behavior</h6>
|
||
<p>Integers are truncated from the high end. When storing into a bit-slice of
|
||
length <code>n</code>, the <code>n</code> least numerically significant bits are stored, and any
|
||
remaining high bits are ignored.</p>
|
||
<p>Be aware of this behavior if you are storing signed integers! The signed integer
|
||
<code>-14i8</code> (bit pattern <code>0b1111_0010u8</code>) will, when stored into and loaded back
|
||
from a 4-bit slice, become the value <code>2i8</code>.</p>
|
||
<h6 id="examples-104"><a class="doc-anchor" href="#examples-104">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = <span class="number">0u8</span>;
|
||
raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.store_le(<span class="number">22u8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);
|
||
<span class="comment">// 01 23456 7
|
||
</span>raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.store_le(-<span class="number">10i8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the little-endian element ordering
|
||
means that the slice index increases with numerical significance:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = [!<span class="number">0u8</span>; <span class="number">3</span>];
|
||
raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.store_le(<span class="number">0x2018u16</span>);
|
||
<span class="macro">assert_eq!</span>(raw, [
|
||
<span class="number">0xF_8</span>,
|
||
<span class="comment">// 0 7
|
||
</span><span class="number">0x0_1</span>,
|
||
<span class="comment">// 8 15
|
||
</span><span class="number">0x2_F</span>,
|
||
<span class="comment">// 16 23
|
||
</span>]);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and store functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.store_be-1" class="method trait-impl"><a href="#method.store_be-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#tymethod.store_be" class="fn">store_be</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class="docblock"><h5 id="msb0-big-endian-integer-storing"><a class="doc-anchor" href="#msb0-big-endian-integer-storing">§</a><code>Msb0</code> Big-Endian Integer Storing</h5>
|
||
<p>This implementation uses the <code>Msb0</code> bit-ordering to determine <em>which</em> bits in a
|
||
partially-occupied memory element are used for storage, using big-endian element
|
||
ordering.</p>
|
||
<p>See the <a href="trait._.html#tymethod.store_be" title="method common_base::bit_vec::prelude::_::store_be">trait method definition</a> for an overview of what element ordering
|
||
means.</p>
|
||
<h6 id="narrowing-behavior-3"><a class="doc-anchor" href="#narrowing-behavior-3">§</a>Narrowing Behavior</h6>
|
||
<p>Integers are truncated from the high end. When storing into a bit-slice of
|
||
length <code>n</code>, the <code>n</code> least numerically significant bits are stored, and any
|
||
remaining high bits are ignored.</p>
|
||
<p>Be aware of this behavior if you are storing signed integers! The signed integer
|
||
<code>-14i8</code> (bit pattern <code>0b1111_0010u8</code>) will, when stored into and loaded back
|
||
from a 4-bit slice, become the value <code>2i8</code>.</p>
|
||
<h6 id="examples-105"><a class="doc-anchor" href="#examples-105">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = <span class="number">0u8</span>;
|
||
raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.store_be(<span class="number">22u8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);
|
||
<span class="comment">// 01 23456 7
|
||
</span>raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">2 </span>.. <span class="number">7</span>]
|
||
.store_be(-<span class="number">10i8</span>);
|
||
<span class="macro">assert_eq!</span>(raw, <span class="number">0b00_10110_0</span>);</code></pre></div>
|
||
<p>In bit-slices that span multiple elements, the big-endian element ordering means
|
||
that the slice index increases while numerical significance decreases:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>raw = [!<span class="number">0u8</span>; <span class="number">3</span>];
|
||
raw.view_bits_mut::<Msb0>()
|
||
[<span class="number">4 </span>.. <span class="number">20</span>]
|
||
.store_be(<span class="number">0x2018u16</span>);
|
||
<span class="macro">assert_eq!</span>(raw, [
|
||
<span class="number">0xF_2</span>,
|
||
<span class="comment">// 0 7
|
||
</span><span class="number">0x0_1</span>,
|
||
<span class="comment">// 8 15
|
||
</span><span class="number">0x8_F</span>,
|
||
<span class="comment">// 16 23
|
||
</span>]);</code></pre></div>
|
||
<p>Note that while these examples use <code>u8</code> storage for convenience in displaying
|
||
the literals, <code>BitField</code> operates identically with <em>any</em> storage type. As most
|
||
machines use little-endian <em>byte ordering</em> within wider element types, and
|
||
<code>bitvec</code> exclusively operates on <em>elements</em>, the actual bytes of memory may
|
||
rapidly start to behave oddly when translating between numeric literals and
|
||
in-memory representation.</p>
|
||
<p>The <a href="https://bitvecto-rs.github.io/bitvec/memory-layout">user guide</a> has a chapter that translates bit indices into memory positions
|
||
for each combination of <code><T: BitStore, O: BitOrder></code>, and may be of additional
|
||
use when choosing a combination of type parameters and store functions.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.load-1" class="method trait-impl"><a href="#method.load-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#method.load" class="fn">load</a><I>(&self) -> I<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class='docblock'>Integer Loading <a href="trait._.html#method.load">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.store-1" class="method trait-impl"><a href="#method.store-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait._.html#method.store" class="fn">store</a><I>(&mut self, value: I)<div class="where">where
|
||
I: Integral,</div></h4></section></summary><div class='docblock'>Integer Storing <a href="trait._.html#method.store">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitOrAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><&<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-1" class="method trait-impl"><a href="#method.bitor_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitOrAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><&<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-3" class="method trait-impl"><a href="#method.bitor_assign-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-BitOrAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-4" class="method trait-impl"><a href="#method.bitor_assign-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)</h4></section></summary><div class="docblock"><h5 id="boolean-arithmetic-1"><a class="doc-anchor" href="#boolean-arithmetic-1">§</a>Boolean Arithmetic</h5>
|
||
<p>This merges another bit-slice into <code>self</code> with a Boolean arithmetic operation.
|
||
If the other bit-slice is shorter than <code>self</code>, it is zero-extended. For <code>BitAnd</code>,
|
||
this clears all excess bits of <code>self</code> to <code>0</code>; for <code>BitOr</code> and <code>BitXor</code>, it
|
||
leaves them untouched</p>
|
||
<h6 id="behavior-2"><a class="doc-anchor" href="#behavior-2">§</a>Behavior</h6>
|
||
<p>The Boolean operation proceeds across each bit-slice in iteration order. This is
|
||
<code>3O(n)</code> in the length of the shorter of <code>self</code> and <code>rhs</code>. However, it can be
|
||
accelerated if <code>rhs</code> has the same type parameters as <code>self</code>, and both are using
|
||
one of the orderings provided by <code>bitvec</code>. In this case, the implementation
|
||
specializes to use <code>BitField</code> batch operations to operate on the slices one word
|
||
at a time, rather than one bit.</p>
|
||
<p>Acceleration is not currently provided for custom bit-orderings that use the
|
||
same storage type.</p>
|
||
<h6 id="pre-10-behavior-1"><a class="doc-anchor" href="#pre-10-behavior-1">§</a>Pre-<code>1.0</code> Behavior</h6>
|
||
<p>In the <code>0.</code> development series, Boolean arithmetic was implemented against all
|
||
<code>I: Iterator<Item = bool></code>. This allowed code such as <code>bits |= [false, true];</code>,
|
||
but forbad acceleration in the most common use case (combining two bit-slices)
|
||
because <code>BitSlice</code> is not such an iterator.</p>
|
||
<p>Usage surveys indicate that it is better for the arithmetic operators to operate
|
||
on bit-slices, and to allow the possibility of specialized acceleration, rather
|
||
than to allow folding against any iterator of <code>bool</code>s.</p>
|
||
<p>If pre-<code>1.0</code> code relies on this behavior specifically, and has non-<code>BitSlice</code>
|
||
arguments to the Boolean sigils, then they will need to be replaced with the
|
||
equivalent loop.</p>
|
||
<h6 id="examples-91"><a class="doc-anchor" href="#examples-91">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>a = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>b = <span class="macro">bits!</span>[ <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
|
||
<span class="kw-2">*</span>a ^= b;
|
||
<span class="macro">assert_eq!</span>(a, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);
|
||
|
||
<span class="kw">let </span>c = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>d = [<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="comment">// no longer allowed
|
||
// c &= d.into_iter().by_vals();
|
||
</span><span class="kw">for </span>(<span class="kw-2">mut </span>c, d) <span class="kw">in </span>c.iter_mut().zip(d.into_iter())
|
||
{
|
||
<span class="kw-2">*</span>c ^= d;
|
||
}
|
||
<span class="macro">assert_eq!</span>(c, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitOrAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><&<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-6" class="method trait-impl"><a href="#method.bitor_assign-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitOrAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign" class="method trait-impl"><a href="#method.bitor_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitOrAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-2" class="method trait-impl"><a href="#method.bitor_assign-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitOrAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitOrAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html" title="trait core::ops::bit::BitOrAssign">BitOrAssign</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitor_assign-5" class="method trait-impl"><a href="#method.bitor_assign-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign" class="fn">bitor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>|=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitOrAssign.html#tymethod.bitor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitXorAssign%3C%26BitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><&<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-1" class="method trait-impl"><a href="#method.bitxor_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitXorAssign%3C%26BitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><&<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-3" class="method trait-impl"><a href="#method.bitxor_assign-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-BitXorAssign%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-4" class="method trait-impl"><a href="#method.bitxor_assign-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>)</h4></section></summary><div class="docblock"><h5 id="boolean-arithmetic-2"><a class="doc-anchor" href="#boolean-arithmetic-2">§</a>Boolean Arithmetic</h5>
|
||
<p>This merges another bit-slice into <code>self</code> with a Boolean arithmetic operation.
|
||
If the other bit-slice is shorter than <code>self</code>, it is zero-extended. For <code>BitAnd</code>,
|
||
this clears all excess bits of <code>self</code> to <code>0</code>; for <code>BitOr</code> and <code>BitXor</code>, it
|
||
leaves them untouched</p>
|
||
<h6 id="behavior-3"><a class="doc-anchor" href="#behavior-3">§</a>Behavior</h6>
|
||
<p>The Boolean operation proceeds across each bit-slice in iteration order. This is
|
||
<code>3O(n)</code> in the length of the shorter of <code>self</code> and <code>rhs</code>. However, it can be
|
||
accelerated if <code>rhs</code> has the same type parameters as <code>self</code>, and both are using
|
||
one of the orderings provided by <code>bitvec</code>. In this case, the implementation
|
||
specializes to use <code>BitField</code> batch operations to operate on the slices one word
|
||
at a time, rather than one bit.</p>
|
||
<p>Acceleration is not currently provided for custom bit-orderings that use the
|
||
same storage type.</p>
|
||
<h6 id="pre-10-behavior-2"><a class="doc-anchor" href="#pre-10-behavior-2">§</a>Pre-<code>1.0</code> Behavior</h6>
|
||
<p>In the <code>0.</code> development series, Boolean arithmetic was implemented against all
|
||
<code>I: Iterator<Item = bool></code>. This allowed code such as <code>bits |= [false, true];</code>,
|
||
but forbad acceleration in the most common use case (combining two bit-slices)
|
||
because <code>BitSlice</code> is not such an iterator.</p>
|
||
<p>Usage surveys indicate that it is better for the arithmetic operators to operate
|
||
on bit-slices, and to allow the possibility of specialized acceleration, rather
|
||
than to allow folding against any iterator of <code>bool</code>s.</p>
|
||
<p>If pre-<code>1.0</code> code relies on this behavior specifically, and has non-<code>BitSlice</code>
|
||
arguments to the Boolean sigils, then they will need to be replaced with the
|
||
equivalent loop.</p>
|
||
<h6 id="examples-92"><a class="doc-anchor" href="#examples-92">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>a = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>b = <span class="macro">bits!</span>[ <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>];
|
||
|
||
<span class="kw-2">*</span>a ^= b;
|
||
<span class="macro">assert_eq!</span>(a, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);
|
||
|
||
<span class="kw">let </span>c = <span class="macro">bits!</span>[<span class="kw-2">mut </span><span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>];
|
||
<span class="kw">let </span>d = [<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="comment">// no longer allowed
|
||
// c &= d.into_iter().by_vals();
|
||
</span><span class="kw">for </span>(<span class="kw-2">mut </span>c, d) <span class="kw">in </span>c.iter_mut().zip(d.into_iter())
|
||
{
|
||
<span class="kw-2">*</span>c ^= d;
|
||
}
|
||
<span class="macro">assert_eq!</span>(c, <span class="macro">bits!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>]);</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitXorAssign%3C%26BitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><&<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-6" class="method trait-impl"><a href="#method.bitxor_assign-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="impl"><a href="#impl-BitXorAssign%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign" class="method trait-impl"><a href="#method.bitxor_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitXorAssign%3CBitBox%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-2" class="method trait-impl"><a href="#method.bitxor_assign-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BitXorAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-BitXorAssign%3CBitVec%3CT,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html" title="trait core::ops::bit::BitXorAssign">BitXorAssign</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.bitxor_assign-5" class="method trait-impl"><a href="#method.bitxor_assign-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign" class="fn">bitxor_assign</a>(&mut self, rhs: <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O>)</h4></section></summary><div class='docblock'>Performs the <code>^=</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.BitXorAssign.html#tymethod.bitxor_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Borrow%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="impl"><a href="#impl-Borrow%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</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 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<<A as BitView>::Store, O>">ⓘ</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" open><summary><section id="impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="impl"><a href="#impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow-1" class="method trait-impl"><a href="#method.borrow-1" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</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" open><summary><section id="impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-Borrow%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow-2" class="method trait-impl"><a href="#method.borrow-2" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</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" open><summary><section id="impl-BorrowMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="impl"><a href="#impl-BorrowMut%3CBitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</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 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) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<<A as BitView>::Store, O>">ⓘ</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" open><summary><section id="impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="impl"><a href="#impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut-1" class="method trait-impl"><a href="#method.borrow_mut-1" 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) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</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" open><summary><section id="impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-BorrowMut%3CBitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut-2" class="method trait-impl"><a href="#method.borrow_mut-2" 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) -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</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" open><summary><section id="impl-Debug-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Debug-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Debug">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a href="#method.fmt" 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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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-%26BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Default-for-%26BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Default-1">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><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>() -> &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&BitSlice<T, O>">ⓘ</a></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-Default-for-%26mut+BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Default-for-%26mut+BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Default">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default-1" class="method trait-impl"><a href="#method.default-1" 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>() -> &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> <a href="#" class="tooltip" data-notable-ty="&mut BitSlice<T, O>">ⓘ</a></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-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Display-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-2" class="method trait-impl"><a href="#method.fmt-2" 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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="impl"><a href="#impl-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitBox%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><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>(slice: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>) -> <a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T, O></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-From%3C%26BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a href="#method.from-1" 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>(slice: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>) -> <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O> <a href="#" class="tooltip" data-notable-ty="BitVec<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26mut+BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="impl"><a href="#impl-From%3C%26mut+BitSlice%3CT,+O%3E%3E-for-BitVec%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>> for <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a href="#method.from-2" 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>(slice: &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>) -> <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O> <a href="#" class="tooltip" data-notable-ty="BitVec<T, O>">ⓘ</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Hash-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Hash">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><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>(&self, hasher: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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>,</div></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></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a href="#associatedtype.Output-1" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-1" class="method trait-impl"><a href="#method.index-1" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<Range<usize>>>::Output">ⓘ</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-Index%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-2" class="associatedtype trait-impl"><a href="#associatedtype.Output-2" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-2" class="method trait-impl"><a href="#method.index-2" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<RangeFrom<usize>>>::Output">ⓘ</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-Index%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-3" class="associatedtype trait-impl"><a href="#associatedtype.Output-3" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-3" class="method trait-impl"><a href="#method.index-3" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<RangeFull>>::Output">ⓘ</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-Index%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-4" class="associatedtype trait-impl"><a href="#associatedtype.Output-4" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-4" class="method trait-impl"><a href="#method.index-4" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<RangeInclusive<usize>>>::Output">ⓘ</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-Index%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-5" class="associatedtype trait-impl"><a href="#associatedtype.Output-5" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-5" class="method trait-impl"><a href="#method.index-5" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<RangeTo<usize>>>::Output">ⓘ</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-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a href="#associatedtype.Output-6" 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="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-6" class="method trait-impl"><a href="#method.index-6" 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,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<RangeToInclusive<usize>>>::Output">ⓘ</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-Index%3Cusize%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Index%3Cusize%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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/std/primitive.usize.html">usize</a>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index" class="method trait-impl"><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, index: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> &<<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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/std/primitive.usize.html">usize</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&<BitSlice<T, O> as Index<usize>>::Output">ⓘ</a></h4></section></summary><div class="docblock"><p>Looks up a single bit by its semantic index.</p>
|
||
<h6 id="examples-93"><a class="doc-anchor" href="#examples-93">§</a>Examples</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[u8, Msb0; <span class="number">0</span>, <span class="number">1</span>, <span class="number">0</span>];
|
||
<span class="macro">assert!</span>(!bits[<span class="number">0</span>]); <span class="comment">// -----^ | |
|
||
</span><span class="macro">assert!</span>( bits[<span class="number">1</span>]); <span class="comment">// --------^ |
|
||
</span><span class="macro">assert!</span>(!bits[<span class="number">2</span>]); <span class="comment">// -----------^</span></code></pre></div>
|
||
<p>If the index is greater than or equal to the length, indexing will
|
||
panic.</p>
|
||
<p>The below test will panic when accessing index 1, as only index 0 is
|
||
valid.</p>
|
||
|
||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>bits = <span class="macro">bits!</span>[<span class="number">0</span>, ];
|
||
bits[<span class="number">1</span>]; <span class="comment">// --------^</span></code></pre></div></div></details><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><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/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRange%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut" class="method trait-impl"><a href="#method.index_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<Range<usize>>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRangeFrom%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-1" class="method trait-impl"><a href="#method.index_mut-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<RangeFrom<usize>>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRangeFull%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-2" class="method trait-impl"><a href="#method.index_mut-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<RangeFull>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRangeInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-3" class="method trait-impl"><a href="#method.index_mut-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<RangeInclusive<usize>>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRangeTo%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-4" class="method trait-impl"><a href="#method.index_mut-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<RangeTo<usize>>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IndexMut%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IndexMut%3CRangeToInclusive%3Cusize%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html" title="trait core::ops::index::IndexMut">IndexMut</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.index_mut-5" class="method trait-impl"><a href="#method.index_mut-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut" class="fn">index_mut</a>(
|
||
&mut self,
|
||
index: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>,
|
||
) -> &mut <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" title="type core::ops::index::Index::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="&mut <BitSlice<T, O> as Index<RangeToInclusive<usize>>>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the mutable indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.IndexMut.html#tymethod.index_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IntoIterator-for-%26BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: 'a + <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/core/iter/trait.IntoIterator.html#impl-IntoIterator-1">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><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> = Iter<'a, T, O></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><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 <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><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 <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a> <a href="#" class="tooltip" data-notable-ty="<&'a BitSlice<T, O> as IntoIterator>::IntoIter">ⓘ</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-%26mut+BitSlice%3CT,+O%3E" class="impl"><a href="#impl-IntoIterator-for-%26mut+BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, O> <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 mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: 'a + <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/core/iter/trait.IntoIterator.html#impl-IntoIterator-3">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.IntoIter-1" class="associatedtype trait-impl"><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> = IterMut<'a, T, O></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle" open><summary><section id="associatedtype.Item-1" class="associatedtype trait-impl"><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 mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::traits::iterator::Iterator::Item">Item</a></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter-1" class="method trait-impl"><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 mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <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>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a> <a href="#" class="tooltip" data-notable-ty="<&'a mut BitSlice<T, O> as IntoIterator>::IntoIter">ⓘ</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-LowerHex-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-LowerHex-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.html" title="trait core::fmt::LowerHex">LowerHex</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-rendering-1"><a class="doc-anchor" href="#bit-slice-rendering-1">§</a>Bit-Slice Rendering</h4>
|
||
<p>This implementation prints the contents of a <code>&BitSlice</code> in one of binary,
|
||
octal, or hexadecimal. It is important to note that this does <em>not</em> render the
|
||
raw underlying memory! They render the semantically-ordered contents of the
|
||
bit-slice as numerals. This distinction matters if you use type parameters that
|
||
differ from those presumed by your debugger (which is usually <code><u8, Msb0></code>).</p>
|
||
</div></section></summary><div class="docblock"><p>The output separates the <code>T</code> elements as individual list items, and renders each
|
||
element as a base- 2, 8, or 16 numeric string. When walking an element, the bits
|
||
traversed by the bit-slice are considered to be stored in
|
||
most-significant-bit-first ordering. This means that index <code>[0]</code> is the high bit
|
||
of the left-most digit, and index <code>[n]</code> is the low bit of the right-most digit,
|
||
in a given printed word.</p>
|
||
<p>In order to render according to expectations of the Arabic numeral system, an
|
||
element being transcribed is chunked into digits from the least-significant end
|
||
of its rendered form. This is most noticeable in octal, which will always have a
|
||
smaller ceiling on the left-most digit in a printed word, while the right-most
|
||
digit in that word is able to use the full <code>0 ..= 7</code> numeral range.</p>
|
||
<h5 id="examples-95"><a class="doc-anchor" href="#examples-95">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [
|
||
<span class="number">0b000000_10u8</span>,
|
||
<span class="comment">// digits print LTR
|
||
</span><span class="number">0b10_001_101</span>,
|
||
<span class="comment">// significance is computed RTL
|
||
</span><span class="number">0b01_000000</span>,
|
||
];
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Msb0>()[<span class="number">6 </span>.. <span class="number">18</span>];
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:b}"</span>, bits), <span class="string">"[10, 10001101, 01]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:o}"</span>, bits), <span class="string">"[2, 215, 1]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:X}"</span>, bits), <span class="string">"[2, 8D, 1]"</span>);</code></pre></div>
|
||
<p>The <code>{:#}</code> format modifier causes the standard <code>0b</code>, <code>0o</code>, or <code>0x</code> prefix to be
|
||
applied to each printed word. The other format specifiers are not interpreted by
|
||
this implementation, and apply to the entire rendered text, not to individual
|
||
words.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-3" class="method trait-impl"><a href="#method.fmt-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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.LowerHex.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Not-for-%26mut+BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Not-for-%26mut+BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html" title="trait core::ops::bit::Not">Not</a> for &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Inverts each bit in the bit-slice.</p>
|
||
</div></section></summary><div class="docblock"><p>Unlike the <code>&</code>, <code>|</code>, and <code>^</code> operators, this implementation is guaranteed to
|
||
update each memory element only once, and is not required to traverse every live
|
||
bit in the underlying region.</p>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-7" class="associatedtype trait-impl"><a href="#associatedtype.Output-7" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html#associatedtype.Output" class="associatedtype">Output</a> = &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h4></section></summary><div class='docblock'>The resulting type after applying the <code>!</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.not" class="method trait-impl"><a href="#method.not" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html#tymethod.not" class="fn">not</a>(self) -> <&'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html" title="trait core::ops::bit::Not">Not</a>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html#associatedtype.Output" title="type core::ops::bit::Not::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<&'a mut BitSlice<T, O> as Not>::Output">ⓘ</a></h4></section></summary><div class='docblock'>Performs the unary <code>!</code> operation. <a href="https://doc.rust-lang.org/nightly/core/ops/bit/trait.Not.html#tymethod.not">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Octal-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Octal-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.html" title="trait core::fmt::Octal">Octal</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-rendering-2"><a class="doc-anchor" href="#bit-slice-rendering-2">§</a>Bit-Slice Rendering</h4>
|
||
<p>This implementation prints the contents of a <code>&BitSlice</code> in one of binary,
|
||
octal, or hexadecimal. It is important to note that this does <em>not</em> render the
|
||
raw underlying memory! They render the semantically-ordered contents of the
|
||
bit-slice as numerals. This distinction matters if you use type parameters that
|
||
differ from those presumed by your debugger (which is usually <code><u8, Msb0></code>).</p>
|
||
</div></section></summary><div class="docblock"><p>The output separates the <code>T</code> elements as individual list items, and renders each
|
||
element as a base- 2, 8, or 16 numeric string. When walking an element, the bits
|
||
traversed by the bit-slice are considered to be stored in
|
||
most-significant-bit-first ordering. This means that index <code>[0]</code> is the high bit
|
||
of the left-most digit, and index <code>[n]</code> is the low bit of the right-most digit,
|
||
in a given printed word.</p>
|
||
<p>In order to render according to expectations of the Arabic numeral system, an
|
||
element being transcribed is chunked into digits from the least-significant end
|
||
of its rendered form. This is most noticeable in octal, which will always have a
|
||
smaller ceiling on the left-most digit in a printed word, while the right-most
|
||
digit in that word is able to use the full <code>0 ..= 7</code> numeral range.</p>
|
||
<h5 id="examples-96"><a class="doc-anchor" href="#examples-96">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [
|
||
<span class="number">0b000000_10u8</span>,
|
||
<span class="comment">// digits print LTR
|
||
</span><span class="number">0b10_001_101</span>,
|
||
<span class="comment">// significance is computed RTL
|
||
</span><span class="number">0b01_000000</span>,
|
||
];
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Msb0>()[<span class="number">6 </span>.. <span class="number">18</span>];
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:b}"</span>, bits), <span class="string">"[10, 10001101, 01]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:o}"</span>, bits), <span class="string">"[2, 215, 1]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:X}"</span>, bits), <span class="string">"[2, 8D, 1]"</span>);</code></pre></div>
|
||
<p>The <code>{:#}</code> format modifier causes the standard <code>0b</code>, <code>0o</code>, or <code>0x</code> prefix to be
|
||
applied to each printed word. The other format specifiers are not interpreted by
|
||
this implementation, and apply to the entire rendered text, not to individual
|
||
words.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-4" class="method trait-impl"><a href="#method.fmt-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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.Octal.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Ord-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Ord">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>) -> <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></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-7" class="method trait-impl"><a href="#method.eq-7" 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, rhs: &&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-7" 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#264">Source</a></span><a href="#method.ne-7" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-8" class="method trait-impl"><a href="#method.eq-8" 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, rhs: &&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-8" 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#264">Source</a></span><a href="#method.ne-8" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitArray%3CA,+O2%3E%3E-for-BitSlice%3CT,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitArray%3CA,+O2%3E%3E-for-BitSlice%3CT,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<O1, A, O2, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><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: &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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#264">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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl"><a href="#method.eq-2" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-2" 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#264">Source</a></span><a href="#method.ne-2" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl"><a href="#method.eq-3" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-3" 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#264">Source</a></span><a href="#method.ne-3" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl"><a href="#method.eq-1" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-1" 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#264">Source</a></span><a href="#method.ne-1" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-5" class="method trait-impl"><a href="#method.eq-5" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-5" 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#264">Source</a></span><a href="#method.ne-5" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-6" class="method trait-impl"><a href="#method.eq-6" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-6" 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#264">Source</a></span><a href="#method.ne-6" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Tests if two <code>BitSlice</code>s are semantically — not representationally — equal.</p>
|
||
</div></section></summary><div class="docblock"><p>It is valid to compare slices of different ordering or memory types.</p>
|
||
<p>The equality condition requires that they have the same length and that at each
|
||
index, the two slices have the same bit value.</p>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-PartialEq%3C%5BB%5D%3E">Original</a></p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-4" class="method trait-impl"><a href="#method.eq-4" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-4" 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#264">Source</a></span><a href="#method.ne-4" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-10" class="method trait-impl"><a href="#method.eq-10" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-10" 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#264">Source</a></span><a href="#method.ne-10" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-11" class="method trait-impl"><a href="#method.eq-11" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-11" 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#264">Source</a></span><a href="#method.ne-11" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialEq%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-9" class="method trait-impl"><a href="#method.eq-9" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-9" 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#264">Source</a></span><a href="#method.ne-9" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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%3C%26BitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3C%26BitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-10" class="method trait-impl"><a href="#method.partial_cmp-10" 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, rhs: &&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-10" 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#1398">Source</a></span><a href="#method.lt-10" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-10" 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#1416">Source</a></span><a href="#method.le-10" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-10" 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#1434">Source</a></span><a href="#method.gt-10" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-10" 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#1452">Source</a></span><a href="#method.ge-10" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3C%26BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-7" class="method trait-impl"><a href="#method.partial_cmp-7" 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, rhs: &&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-7" 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#1398">Source</a></span><a href="#method.lt-7" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-7" 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#1416">Source</a></span><a href="#method.le-7" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-7" 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#1434">Source</a></span><a href="#method.gt-7" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-7" 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#1452">Source</a></span><a href="#method.ge-7" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-9" class="method trait-impl"><a href="#method.partial_cmp-9" 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, rhs: &&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-9" 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#1398">Source</a></span><a href="#method.lt-9" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-9" 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#1416">Source</a></span><a href="#method.le-9" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-9" 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#1434">Source</a></span><a href="#method.gt-9" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-9" 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#1452">Source</a></span><a href="#method.ge-9" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3C%26mut+BitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-8" class="method trait-impl"><a href="#method.partial_cmp-8" 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, rhs: &&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-8" 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#1398">Source</a></span><a href="#method.lt-8" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-8" 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#1416">Source</a></span><a href="#method.le-8" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-8" 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#1434">Source</a></span><a href="#method.gt-8" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-8" 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#1452">Source</a></span><a href="#method.ge-8" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-PartialOrd%3CBitArray%3CA,+O%3E%3E-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><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: &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>) -> <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#1398">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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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#1416">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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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#1434">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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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#1452">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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<'a, O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for &'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-2" class="method trait-impl"><a href="#method.partial_cmp-2" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <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-2" 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#1398">Source</a></span><a href="#method.lt-2" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-2" 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#1416">Source</a></span><a href="#method.le-2" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-2" 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#1434">Source</a></span><a href="#method.gt-2" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-2" 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#1452">Source</a></span><a href="#method.ge-2" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<'a, O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-3" class="method trait-impl"><a href="#method.partial_cmp-3" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <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-3" 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#1398">Source</a></span><a href="#method.lt-3" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-3" 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#1416">Source</a></span><a href="#method.le-3" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-3" 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#1434">Source</a></span><a href="#method.gt-3" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-3" 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#1452">Source</a></span><a href="#method.ge-3" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitBox%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<O1, O2, T1, T2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-1" class="method trait-impl"><a href="#method.partial_cmp-1" 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: &<a class="struct" href="struct.BitBox.html" title="struct common_base::bit_vec::prelude::BitBox">BitBox</a><T2, O2>) -> <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-1" 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#1398">Source</a></span><a href="#method.lt-1" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-1" 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#1416">Source</a></span><a href="#method.le-1" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-1" 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#1434">Source</a></span><a href="#method.gt-1" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-1" 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#1452">Source</a></span><a href="#method.ge-1" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-5" class="method trait-impl"><a href="#method.partial_cmp-5" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-5" 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#1398">Source</a></span><a href="#method.lt-5" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-5" 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#1416">Source</a></span><a href="#method.le-5" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-5" 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#1434">Source</a></span><a href="#method.gt-5" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-5" 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#1452">Source</a></span><a href="#method.ge-5" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-6" class="method trait-impl"><a href="#method.partial_cmp-6" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-6" 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#1398">Source</a></span><a href="#method.lt-6" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-6" 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#1416">Source</a></span><a href="#method.le-6" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-6" 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#1434">Source</a></span><a href="#method.gt-6" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-6" 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#1452">Source</a></span><a href="#method.ge-6" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitSlice%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Compares two <code>BitSlice</code>s by semantic — not representational — ordering.</p>
|
||
</div></section></summary><div class="docblock"><p>The comparison sorts by testing at each index if one slice has a high bit where
|
||
the other has a low. At the first index where the slices differ, the slice with
|
||
the high bit is greater. If the slices are equal until at least one terminates,
|
||
then they are compared by length.</p>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-PartialOrd%3C%5BT%5D%3E">Original</a></p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-4" class="method trait-impl"><a href="#method.partial_cmp-4" 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, rhs: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T2, O2>) -> <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-4" 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#1398">Source</a></span><a href="#method.lt-4" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-4" 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#1416">Source</a></span><a href="#method.le-4" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-4" 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#1434">Source</a></span><a href="#method.gt-4" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-4" 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#1452">Source</a></span><a href="#method.ge-4" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for &'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-12" class="method trait-impl"><a href="#method.partial_cmp-12" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <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-12" 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#1398">Source</a></span><a href="#method.lt-12" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-12" 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#1416">Source</a></span><a href="#method.le-12" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-12" 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#1434">Source</a></span><a href="#method.gt-12" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-12" 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#1452">Source</a></span><a href="#method.ge-12" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-%26mut+BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-13" class="method trait-impl"><a href="#method.partial_cmp-13" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <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-13" 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#1398">Source</a></span><a href="#method.lt-13" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-13" 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#1416">Source</a></span><a href="#method.le-13" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-13" 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#1434">Source</a></span><a href="#method.gt-13" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-13" 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#1452">Source</a></span><a href="#method.ge-13" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="impl"><a href="#impl-PartialOrd%3CBitVec%3CT2,+O2%3E%3E-for-BitSlice%3CT1,+O1%3E" class="anchor">§</a><h3 class="code-header">impl<T1, T2, O1, O2> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T1, O1><div class="where">where
|
||
T1: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
T2: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O1: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
O2: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-11" class="method trait-impl"><a href="#method.partial_cmp-11" 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: &<a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T2, O2>) -> <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-11" 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#1398">Source</a></span><a href="#method.lt-11" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-11" 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#1416">Source</a></span><a href="#method.le-11" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-11" 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#1434">Source</a></span><a href="#method.gt-11" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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-11" 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#1452">Source</a></span><a href="#method.ge-11" 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/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/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><details class="toggle implementors-toggle" open><summary><section id="impl-Pointer-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Pointer-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Pointer.html" title="trait core::fmt::Pointer">Pointer</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-6" class="method trait-impl"><a href="#method.fmt-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Pointer.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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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.Pointer.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Read-for-%26BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Read-for-%26BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitField</a>,</div></h3><div class="docblock"><h4 id="reading-from-a-bit-slice"><a class="doc-anchor" href="#reading-from-a-bit-slice">§</a>Reading From a Bit-Slice</h4>
|
||
<p>The implementation loads bytes out of the referenced bit-slice until either the
|
||
destination buffer is filled or the source has no more bytes to provide. When
|
||
<code>.read()</code> returns, the provided bit-slice handle will have been updated to no
|
||
longer include the leading segment copied out as bytes into <code>buf</code>.</p>
|
||
</div></section></summary><div class="docblock"><p>Note that the return value of <code>.read()</code> is always the number of <em>bytes</em> of <code>buf</code>
|
||
filled!</p>
|
||
<p>The implementation uses <a href="trait._.html#tymethod.load_be" title="method common_base::bit_vec::prelude::_::load_be"><code>BitField::load_be</code></a> to collect bytes. Note that unlike
|
||
the standard library, it is implemented on bit-slices of <em>any</em> underlying
|
||
element type. However, using a <code>BitSlice<_, u8></code> is still likely to be fastest.</p>
|
||
<h5 id="original-64"><a class="doc-anchor" href="#original-64">§</a>Original</h5>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Read"><code>impl Read for [u8]</code></a></p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read" class="method trait-impl"><a href="#method.read" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" class="fn">read</a>(&mut self, buf: &mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Pull some bytes from this source into the specified buffer, returning
|
||
how many bytes were read. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_vectored" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#825">Source</a></span><a href="#method.read_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored" class="fn">read_vectored</a>(&mut self, bufs: &mut [<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_read_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#838">Source</a><a href="#method.is_read_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored" class="fn">is_read_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</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>can_vector</code>)</span></div></span><div class='docblock'>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
|
||
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_to_end" 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/std/io/mod.rs.html#935">Source</a></span><a href="#method.read_to_end" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end" class="fn">read_to_end</a>(&mut self, buf: &mut <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/std/primitive.u8.html">u8</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Reads all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_to_string" 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/std/io/mod.rs.html#991">Source</a></span><a href="#method.read_to_string" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string" class="fn">read_to_string</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Reads all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_exact" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1044">Source</a></span><a href="#method.read_exact" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact" class="fn">read_exact</a>(&mut self, buf: &mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Reads the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_buf" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1057">Source</a><a href="#method.read_buf" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_buf" class="fn">read_buf</a>(&mut self, buf: <a class="struct" href="https://doc.rust-lang.org/nightly/core/io/borrowed_buf/struct.BorrowedCursor.html" title="struct core::io::borrowed_buf::BorrowedCursor">BorrowedCursor</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</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>read_buf</code>)</span></div></span><div class='docblock'>Pull some bytes from this source into the specified buffer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_buf">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_buf_exact" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1080">Source</a><a href="#method.read_buf_exact" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_buf_exact" class="fn">read_buf_exact</a>(&mut self, cursor: <a class="struct" href="https://doc.rust-lang.org/nightly/core/io/borrowed_buf/struct.BorrowedCursor.html" title="struct core::io::borrowed_buf::BorrowedCursor">BorrowedCursor</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</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>read_buf</code>)</span></div></span><div class='docblock'>Reads the exact number of bytes required to fill <code>cursor</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_buf_exact">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref" 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/std/io/mod.rs.html#1119-1121">Source</a></span><a href="#method.by_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref" class="fn">by_ref</a>(&mut self) -> &mut 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'>Creates a “by reference” adapter for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.bytes" 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/std/io/mod.rs.html#1162-1164">Source</a></span><a href="#method.bytes" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes" class="fn">bytes</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><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'>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chain" 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/std/io/mod.rs.html#1200-1202">Source</a></span><a href="#method.chain" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain" class="fn">chain</a><R>(self, next: R) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R><div class="where">where
|
||
R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</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'>Creates an adapter which will chain this stream with another. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.take" 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/std/io/mod.rs.html#1239-1241">Source</a></span><a href="#method.take" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take" class="fn">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Take.html" title="struct std::io::Take">Take</a><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'>Creates an adapter which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ToOwned-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-ToOwned-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-ToOwned">Original</a></p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><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> = <a class="struct" href="struct.BitVec.html" title="struct common_base::bit_vec::prelude::BitVec">BitVec</a><T, O></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 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) -> <<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::borrow::ToOwned::Owned">Owned</a> <a href="#" class="tooltip" data-notable-ty="<BitSlice<T, O> as ToOwned>::Owned">ⓘ</a></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"><span class="rightside"><span class="since" title="Stable since Rust version 1.63.0">1.63.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#78">Source</a></span><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: &mut Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::borrow::ToOwned::Owned">Owned</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" open><summary><section id="impl-TryFrom%3C%26%5BT%5D%3E-for-%26BitSlice%3CT,+O%3E" class="impl"><a href="#impl-TryFrom%3C%26%5BT%5D%3E-for-%26BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Calls <a href="struct.BitSlice.html#method.try_from_slice" title="associated function common_base::bit_vec::prelude::BitSlice::try_from_slice"><code>BitSlice::try_from_slice</code></a>, but returns the original Rust slice on
|
||
error instead of the failure event.</p>
|
||
</div></section></summary><div class="docblock"><p>This only fails if <code>slice.len()</code> exceeds <code>BitSlice::MAX_ELTS</code>.</p>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a href="#associatedtype.Error-3" 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 <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</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-3" class="method trait-impl"><a href="#method.try_from-3" 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>(
|
||
slice: &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, <&'a <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>>::<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" open><summary><section id="impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26BitArray%3CA,+O%3E" class="impl"><a href="#impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for &<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><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> = TryFromBitSliceError</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-1" class="method trait-impl"><a href="#method.try_from-1" 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>(
|
||
src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>, <&<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>>>::<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" open><summary><section id="impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="impl"><a href="#impl-TryFrom%3C%26BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" 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> = TryFromBitSliceError</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 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>(
|
||
src: &<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>, <<a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>>>::<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" open><summary><section id="impl-TryFrom%3C%26mut+%5BT%5D%3E-for-%26mut+BitSlice%3CT,+O%3E" class="impl"><a href="#impl-TryFrom%3C%26mut+%5BT%5D%3E-for-%26mut+BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>> for &'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p>Calls <a href="struct.BitSlice.html#method.try_from_slice_mut" title="associated function common_base::bit_vec::prelude::BitSlice::try_from_slice_mut"><code>BitSlice::try_from_slice_mut</code></a>, but returns the original Rust slice
|
||
on error instead of the failure event.</p>
|
||
</div></section></summary><div class="docblock"><p>This only fails if <code>slice.len()</code> exceeds <code>BitSlice::MAX_ELTS</code>.</p>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a href="#associatedtype.Error-4" 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 mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</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-4" class="method trait-impl"><a href="#method.try_from-4" 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>(
|
||
slice: &'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>, <&'a mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&'a mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>>>::<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" open><summary><section id="impl-TryFrom%3C%26mut+BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26mut+BitArray%3CA,+O%3E" class="impl"><a href="#impl-TryFrom%3C%26mut+BitSlice%3C%3CA+as+BitView%3E::Store,+O%3E%3E-for-%26mut+BitArray%3CA,+O%3E" class="anchor">§</a><h3 class="code-header">impl<A, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>> for &mut <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O><div class="where">where
|
||
A: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitViewSized</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a href="#associatedtype.Error-2" 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> = TryFromBitSliceError</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-2" class="method trait-impl"><a href="#method.try_from-2" 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>(
|
||
src: &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&mut <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O>, <&mut <a class="struct" href="struct.BitArray.html" title="struct common_base::bit_vec::prelude::BitArray">BitArray</a><A, O> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><&mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><<A as <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitView</a>>::<a class="associatedtype" href="trait._.html#associatedtype.Store" title="type common_base::bit_vec::prelude::_::Store">Store</a>, O>>>::<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" open><summary><section id="impl-UpperHex-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-UpperHex-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.html" title="trait core::fmt::UpperHex">UpperHex</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-rendering-3"><a class="doc-anchor" href="#bit-slice-rendering-3">§</a>Bit-Slice Rendering</h4>
|
||
<p>This implementation prints the contents of a <code>&BitSlice</code> in one of binary,
|
||
octal, or hexadecimal. It is important to note that this does <em>not</em> render the
|
||
raw underlying memory! They render the semantically-ordered contents of the
|
||
bit-slice as numerals. This distinction matters if you use type parameters that
|
||
differ from those presumed by your debugger (which is usually <code><u8, Msb0></code>).</p>
|
||
</div></section></summary><div class="docblock"><p>The output separates the <code>T</code> elements as individual list items, and renders each
|
||
element as a base- 2, 8, or 16 numeric string. When walking an element, the bits
|
||
traversed by the bit-slice are considered to be stored in
|
||
most-significant-bit-first ordering. This means that index <code>[0]</code> is the high bit
|
||
of the left-most digit, and index <code>[n]</code> is the low bit of the right-most digit,
|
||
in a given printed word.</p>
|
||
<p>In order to render according to expectations of the Arabic numeral system, an
|
||
element being transcribed is chunked into digits from the least-significant end
|
||
of its rendered form. This is most noticeable in octal, which will always have a
|
||
smaller ceiling on the left-most digit in a printed word, while the right-most
|
||
digit in that word is able to use the full <code>0 ..= 7</code> numeral range.</p>
|
||
<h5 id="examples-97"><a class="doc-anchor" href="#examples-97">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bitvec::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>data = [
|
||
<span class="number">0b000000_10u8</span>,
|
||
<span class="comment">// digits print LTR
|
||
</span><span class="number">0b10_001_101</span>,
|
||
<span class="comment">// significance is computed RTL
|
||
</span><span class="number">0b01_000000</span>,
|
||
];
|
||
<span class="kw">let </span>bits = <span class="kw-2">&</span>data.view_bits::<Msb0>()[<span class="number">6 </span>.. <span class="number">18</span>];
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:b}"</span>, bits), <span class="string">"[10, 10001101, 01]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:o}"</span>, bits), <span class="string">"[2, 215, 1]"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="macro">format!</span>(<span class="string">"{:X}"</span>, bits), <span class="string">"[2, 8D, 1]"</span>);</code></pre></div>
|
||
<p>The <code>{:#}</code> format modifier causes the standard <code>0b</code>, <code>0o</code>, or <code>0x</code> prefix to be
|
||
applied to each printed word. The other format specifiers are not interpreted by
|
||
this implementation, and apply to the entire rendered text, not to individual
|
||
words.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-5" class="method trait-impl"><a href="#method.fmt-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.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="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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</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.UpperHex.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Write-for-%26mut+BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Write-for-%26mut+BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,
|
||
<a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O>: <a class="trait" href="trait._.html" title="trait common_base::bit_vec::prelude::_">BitField</a>,</div></h3><div class="docblock"><h4 id="writing-into-a-bit-slice"><a class="doc-anchor" href="#writing-into-a-bit-slice">§</a>Writing Into a Bit-Slice</h4>
|
||
<p>The implementation stores bytes into the referenced bit-slice until either the
|
||
source buffer is exhausted or the destination has no more slots to fill. When
|
||
<code>.write()</code> returns, the provided bit-slice handle will have been updated to no
|
||
longer include the leading segment filled with bytes from <code>buf</code>.</p>
|
||
</div></section></summary><div class="docblock"><p>Note that the return value of <code>.write()</code> is always the number of <em>bytes</em> of
|
||
<code>buf</code> consumed!</p>
|
||
<p>The implementation uses <a href="trait._.html#tymethod.store_be" title="method common_base::bit_vec::prelude::_::store_be"><code>BitField::store_be</code></a> to fill bytes. Note that unlike
|
||
the standard library, it is implemented on bit-slices of <em>any</em> underlying
|
||
element type. However, using a <code>BitSlice<_, u8></code> is still likely to be fastest.</p>
|
||
<h5 id="original-65"><a class="doc-anchor" href="#original-65">§</a>Original</h5>
|
||
<p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Write"><code>impl Write for [u8]</code></a></p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.write" class="method trait-impl"><a href="#method.write" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write" class="fn">write</a>(&mut self, buf: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Writes a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.flush" class="method trait-impl"><a href="#method.flush" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush" class="fn">flush</a>(&mut self) -> <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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Flushes this output stream, ensuring that all intermediately buffered
|
||
contents reach their destination. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_vectored" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1758">Source</a></span><a href="#method.write_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored" class="fn">write_vectored</a>(&mut self, bufs: &[<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</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/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Like <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write" title="method std::io::Write::write"><code>write</code></a>, except that it writes from a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_write_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1773">Source</a><a href="#method.is_write_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored" class="fn">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</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>can_vector</code>)</span></div></span><div class='docblock'>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored" title="method std::io::Write::write_vectored"><code>write_vectored</code></a>
|
||
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all" 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/std/io/mod.rs.html#1835">Source</a></span><a href="#method.write_all" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all" class="fn">write_all</a>(&mut self, buf: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1897">Source</a><a href="#method.write_all_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored" class="fn">write_all_vectored</a>(&mut self, bufs: &mut [<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</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>write_all_vectored</code>)</span></div></span><div class='docblock'>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_fmt" 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/std/io/mod.rs.html#1950">Source</a></span><a href="#method.write_fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt" class="fn">write_fmt</a>(&mut self, args: <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</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/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Writes a formatted string into this writer, returning any error
|
||
encountered. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref-1" 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/std/io/mod.rs.html#1980-1982">Source</a></span><a href="#method.by_ref-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref" class="fn">by_ref</a>(&mut self) -> &mut 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'>Creates a “by reference” adapter for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref">Read more</a></div></details></div></details><section id="impl-Eq-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Eq-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Eq">Original</a></p>
|
||
</div></section><section id="impl-Send-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Send-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-thread-safety"><a class="doc-anchor" href="#bit-slice-thread-safety">§</a>Bit-Slice Thread Safety</h4>
|
||
<p>This allows bit-slice references to be moved across thread boundaries only when
|
||
the underlying <code>T</code> element can tolerate concurrency.</p>
|
||
</div></section><div class="docblock"><p>All <code>BitSlice</code> references, shared or exclusive, are only threadsafe if the <code>T</code>
|
||
element type is <code>Send</code>, because any given bit-slice reference may only have
|
||
partial control of a memory element that is also being shared by a bit-slice
|
||
reference on another thread. As such, this is never implemented for <code>Cell<U></code>,
|
||
but always implemented for <code>AtomicU</code> and <code>U</code> for a given unsigned integer type
|
||
<code>U</code>.</p>
|
||
<p>Atomic integers safely handle concurrent writes, cells do not allow concurrency
|
||
at all, so the only missing piece is <code>&mut BitSlice<_, U: Unsigned></code>. This is
|
||
handled by the aliasing system that the mutable splitters employ: a mutable
|
||
reference to an unsynchronized bit-slice can only cross threads when no other
|
||
handle is able to exist to the elements it governs. Splitting a mutable
|
||
bit-slice causes the split halves to change over to either atomics or cells, so
|
||
concurrency is either safe or impossible.</p>
|
||
</div><section id="impl-Sync-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Sync-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><h4 id="bit-slice-thread-safety-1"><a class="doc-anchor" href="#bit-slice-thread-safety-1">§</a>Bit-Slice Thread Safety</h4>
|
||
<p>This allows bit-slice references to be moved across thread boundaries only when
|
||
the underlying <code>T</code> element can tolerate concurrency.</p>
|
||
</div></section><div class="docblock"><p>All <code>BitSlice</code> references, shared or exclusive, are only threadsafe if the <code>T</code>
|
||
element type is <code>Send</code>, because any given bit-slice reference may only have
|
||
partial control of a memory element that is also being shared by a bit-slice
|
||
reference on another thread. As such, this is never implemented for <code>Cell<U></code>,
|
||
but always implemented for <code>AtomicU</code> and <code>U</code> for a given unsigned integer type
|
||
<code>U</code>.</p>
|
||
<p>Atomic integers safely handle concurrent writes, cells do not allow concurrency
|
||
at all, so the only missing piece is <code>&mut BitSlice<_, U: Unsigned></code>. This is
|
||
handled by the aliasing system that the mutable splitters employ: a mutable
|
||
reference to an unsynchronized bit-slice can only cross threads when no other
|
||
handle is able to exist to the elements it governs. Splitting a mutable
|
||
bit-slice causes the split halves to change over to either atomics or cells, so
|
||
concurrency is either safe or impossible.</p>
|
||
</div><section id="impl-Unpin-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Unpin-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,
|
||
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h3><div class="docblock"><p><a href="https://doc.rust-lang.org/std/primitive.slice.html#impl-Unpin">Original</a></p>
|
||
</div></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-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Freeze-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h3></section><section id="impl-RefUnwindSafe-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-RefUnwindSafe-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <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>,
|
||
T: <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-Sized-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-Sized-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, O = <a class="struct" href="struct.LocalBits.html" title="struct common_base::bit_vec::prelude::LocalBits">Lsb0</a>> !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> for <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O></h3></section><section id="impl-UnwindSafe-for-BitSlice%3CT,+O%3E" class="impl"><a href="#impl-UnwindSafe-for-BitSlice%3CT,+O%3E" class="anchor">§</a><h3 class="code-header">impl<T, O> <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.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a><T, O><div class="where">where
|
||
O: <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>,
|
||
T: <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#138">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#139">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-3" 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-3" 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/std/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-3" 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-3" 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/std/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-Comparable%3CK%3E-for-Q" class="impl"><a href="#impl-Comparable%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> Comparable<K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<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.compare" class="method trait-impl"><a href="#method.compare" class="anchor">§</a><h4 class="code-header">fn <a class="fn">compare</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&K</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'>Compare self to <code>key</code> and return their ordering.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q" class="impl"><a href="#impl-Equivalent%3CK%3E-for-Q" class="anchor">§</a><h3 class="code-header">impl<Q, K> Equivalent<K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<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.equivalent" class="method trait-impl"><a href="#method.equivalent" class="anchor">§</a><h4 class="code-header">fn <a class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Checks if this value is equivalent to the given key. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Q-1" class="impl"><a href="#impl-Equivalent%3CK%3E-for-Q-1" class="anchor">§</a><h3 class="code-header">impl<Q, K> Equivalent<K> for Q<div class="where">where
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q> + ?<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.equivalent-1" class="method trait-impl"><a href="#method.equivalent-1" class="anchor">§</a><h4 class="code-header">fn <a class="fn">equivalent</a>(&self, key: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&K</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return <code>true</code> if they are equal.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pipe-for-T" class="impl"><a href="#impl-Pipe-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Pipe 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.pipe" class="method trait-impl"><a href="#method.pipe" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self) -> R) -> R<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'>Pipes by value. This is generally the method you want to use. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_ref" class="method trait-impl"><a href="#method.pipe_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_ref</a><'a, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&'a Self) -> R) -> R<div class="where">where
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code> and passes that borrow into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_ref_mut" class="method trait-impl"><a href="#method.pipe_ref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_ref_mut</a><'a, R>(&'a mut self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&'a mut Self) -> R) -> R<div class="where">where
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code> and passes that borrow into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_borrow" class="method trait-impl"><a href="#method.pipe_borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_borrow</a><'a, B, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a B</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><B>,
|
||
B: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.borrow()</code> into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_borrow_mut" class="method trait-impl"><a href="#method.pipe_borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_borrow_mut</a><'a, B, R>(
|
||
&'a mut self,
|
||
func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut B</a>) -> R,
|
||
) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><B>,
|
||
B: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.borrow_mut()</code> into the pipe
|
||
function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_as_ref" class="method trait-impl"><a href="#method.pipe_as_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_as_ref</a><'a, U, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a U</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><U>,
|
||
U: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.as_ref()</code> into the pipe function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_as_mut" class="method trait-impl"><a href="#method.pipe_as_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_as_mut</a><'a, U, R>(&'a mut self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut U</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><U>,
|
||
U: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.as_mut()</code> into the pipe
|
||
function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_deref" class="method trait-impl"><a href="#method.pipe_deref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_deref</a><'a, T, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a T</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = T>,
|
||
T: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.deref()</code> into the pipe function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_deref_mut" class="method trait-impl"><a href="#method.pipe_deref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_deref_mut</a><'a, T, R>(
|
||
&'a mut self,
|
||
func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut T</a>) -> R,
|
||
) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a><Target = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>,
|
||
T: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.deref_mut()</code> into the pipe
|
||
function.</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#2783">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#2785">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></div><script type="text/json" id="notable-traits-data">{"&'a BitSlice<T, O>":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&'a mut BitSlice<T, O>":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<Range<usize>>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<RangeFrom<usize>>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<RangeFull>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<RangeInclusive<usize>>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<RangeTo<usize>>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<RangeToInclusive<usize>>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&<BitSlice<T, O> as Index<usize>>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&BitSlice<<A as BitView>::Store, O>":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&BitSlice<T, O>":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<Range<usize>>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<RangeFrom<usize>>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<RangeFull>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<RangeInclusive<usize>>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<RangeTo<usize>>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut <BitSlice<T, O> as Index<RangeToInclusive<usize>>>::Output":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut BitSlice<<A as BitView>::Store, O>":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","&mut BitSlice<T, O>":"<h3>Notable traits for <code>&mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","<&'a BitSlice<T, O> as IntoIterator>::IntoIter":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","<&'a mut BitSlice<T, O> as IntoIterator>::IntoIter":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","<&'a mut BitSlice<T, O> as Not>::Output":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","<BitSlice<T, O> as ToOwned>::Owned":"<h3>Notable traits for <code>&<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &<a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","BitPtrRange<Const, T, O>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.BitPtrRange.html\" title=\"struct common_base::bit_vec::prelude::BitPtrRange\">BitPtrRange</a><M, T, O></code></h3><pre><code><div class=\"where\">impl<M, T, O> <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.BitPtrRange.html\" title=\"struct common_base::bit_vec::prelude::BitPtrRange\">BitPtrRange</a><M, T, O><div class=\"where\">where\n M: Mutability,\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,</div></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.BitPtr.html\" title=\"struct common_base::bit_vec::prelude::BitPtr\">BitPtr</a><M, T, O>;</div>","BitPtrRange<Mut, T, O>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.BitPtrRange.html\" title=\"struct common_base::bit_vec::prelude::BitPtrRange\">BitPtrRange</a><M, T, O></code></h3><pre><code><div class=\"where\">impl<M, T, O> <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.BitPtrRange.html\" title=\"struct common_base::bit_vec::prelude::BitPtrRange\">BitPtrRange</a><M, T, O><div class=\"where\">where\n M: Mutability,\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,</div></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.BitPtr.html\" title=\"struct common_base::bit_vec::prelude::BitPtr\">BitPtr</a><M, T, O>;</div>","BitVec<<T as BitStore>::Unalias, O>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O><div class=\"where\">where\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>","BitVec<T, O>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O></code></h3><pre><code><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O><div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div><div class=\"where\">impl<T, O> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"struct.BitVec.html\" title=\"struct common_base::bit_vec::prelude::BitVec\">BitVec</a><T, O><div class=\"where\">where\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a><T, O>: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>"}</script></section></div></main></body></html> |