Sign In

bitvec

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitvec - cargo Package Compare versions

Comparing version
1.0.0
to
1.0.1
+4
-3
.cargo_vcs_info.json
{
"git": {
"sha1": "072705d923be88db99b2ed3593ab81c422e28f35"
}
}
"sha1": "c922de6998be994cb5be1a349c7a0a0d16a19f07"
},
"path_in_vcs": ""
}

@@ -18,5 +18,5 @@ # This file is automatically @generated by Cargo.

name = "autocfg"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"

@@ -40,3 +40,3 @@ [[package]]

name = "bitvec"
version = "1.0.0"
version = "1.0.1"
dependencies = [

@@ -70,5 +70,5 @@ "bincode",

name = "bumpalo"
version = "3.8.0"
version = "3.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"

@@ -139,5 +139,5 @@ [[package]]

name = "crossbeam-channel"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
dependencies = [

@@ -161,5 +161,5 @@ "cfg-if",

name = "crossbeam-epoch"
version = "0.9.5"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9"
dependencies = [

@@ -175,5 +175,5 @@ "cfg-if",

name = "crossbeam-utils"
version = "0.8.5"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
dependencies = [

@@ -192,3 +192,3 @@ "cfg-if",

"csv-core",
"itoa",
"itoa 0.4.8",
"ryu",

@@ -221,5 +221,5 @@ "serde",

name = "getrandom"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
dependencies = [

@@ -248,5 +248,5 @@ "cfg-if",

name = "itertools"
version = "0.10.1"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
dependencies = [

@@ -263,6 +263,12 @@ "either",

[[package]]
name = "itoa"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
[[package]]
name = "js-sys"
version = "0.3.55"
version = "0.3.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
dependencies = [

@@ -280,5 +286,5 @@ "wasm-bindgen",

name = "libc"
version = "0.2.108"
version = "0.2.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"

@@ -302,5 +308,5 @@ [[package]]

name = "memoffset"
version = "0.6.4"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [

@@ -321,5 +327,5 @@ "autocfg",

name = "num_cpus"
version = "1.13.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [

@@ -366,11 +372,11 @@ "hermit-abi",

name = "ppv-lite86"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "proc-macro2"
version = "1.0.32"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [

@@ -382,5 +388,5 @@ "unicode-xid",

name = "quote"
version = "1.0.10"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
dependencies = [

@@ -493,5 +499,5 @@ "proc-macro2",

name = "ryu"
version = "1.0.5"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"

@@ -515,11 +521,11 @@ [[package]]

name = "semver"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
checksum = "0486718e92ec9a68fbed73bb5ef687d71103b142595b406835649bebd33f72c7"
[[package]]
name = "serde"
version = "1.0.130"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"

@@ -538,5 +544,5 @@ [[package]]

name = "serde_derive"
version = "1.0.130"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [

@@ -550,7 +556,7 @@ "proc-macro2",

name = "serde_json"
version = "1.0.72"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
dependencies = [
"itoa",
"itoa 1.0.1",
"ryu",

@@ -562,5 +568,5 @@ "serde",

name = "serde_test"
version = "1.0.130"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82178225dbdeae2d5d190e8649287db6a3a32c6d24da22ae3146325aa353e4c"
checksum = "21675ba6f9d97711cc00eee79d8dd7d0a31e571c350fb4d8a7c78f70c0e7b0e9"
dependencies = [

@@ -578,5 +584,5 @@ "serde",

name = "syn"
version = "1.0.82"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
dependencies = [

@@ -644,5 +650,5 @@ "proc-macro2",

name = "wasm-bindgen"
version = "0.2.78"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
dependencies = [

@@ -655,5 +661,5 @@ "cfg-if",

name = "wasm-bindgen-backend"
version = "0.2.78"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
dependencies = [

@@ -671,5 +677,5 @@ "bumpalo",

name = "wasm-bindgen-macro"
version = "0.2.78"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
dependencies = [

@@ -682,5 +688,5 @@ "quote",

name = "wasm-bindgen-macro-support"
version = "0.2.78"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
dependencies = [

@@ -696,11 +702,11 @@ "proc-macro2",

name = "wasm-bindgen-shared"
version = "0.2.78"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
[[package]]
name = "web-sys"
version = "0.3.55"
version = "0.3.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
dependencies = [

@@ -707,0 +713,0 @@ "js-sys",

@@ -16,4 +16,11 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "bitvec"
version = "1.0.0"
include = ["Cargo.toml", "LICENSE.txt", "README.md", "doc/**/*.md", "src/**/*.rs", "benches/*.rs"]
version = "1.0.1"
include = [
"Cargo.toml",
"LICENSE.txt",
"README.md",
"doc/**/*.md",
"src/**/*.rs",
"benches/*.rs",
]
description = "Addresses memory by bits, for packed collections and bitfields"

@@ -23,9 +30,26 @@ homepage = "https://bitvecto-rs.github.io/bitvec"

readme = "README.md"
keywords = ["bitfields", "bitmap", "bitstream", "bitvec", "bitvector"]
categories = ["data-structures", "embedded", "no-std", "rust-patterns"]
keywords = [
"bitfields",
"bitmap",
"bitstream",
"bitvec",
"bitvector",
]
categories = [
"data-structures",
"embedded",
"no-std",
"rust-patterns",
]
license = "MIT"
repository = "https://github.com/bitvecto-rs/bitvec"
resolver = "2"
[package.metadata.docs.rs]
features = ["atomic", "serde", "std"]
features = [
"atomic",
"serde",
"std",
]
[dependencies.funty]

@@ -49,2 +73,3 @@ version = "^2.0"

default-features = false
[dev-dependencies.bincode]

@@ -74,5 +99,9 @@ version = "1.3"

atomic = []
default = ["atomic", "std"]
default = [
"atomic",
"std",
]
std = ["alloc"]
testing = []
[badges.codecov]

@@ -79,0 +108,0 @@ branch = "main"

@@ -109,7 +109,11 @@ # Big-Endian Integer Loading

assert_eq!(
raw.view_bits::<Lsb0>()[14 .. 20].load_be::<u8>(),
raw.view_bits::<Lsb0>()
[14 .. 20]
.load_be::<u8>(),
0b00_01_1110,
);
assert_eq!(
raw.view_bits::<Msb0>()[14 .. 20].load_be::<u8>(),
raw.view_bits::<Msb0>()
[14 .. 20]
.load_be::<u8>(),
0b00_11_0001,

@@ -116,0 +120,0 @@ );

@@ -41,3 +41,3 @@ # Little-Endian Integer Loading

Let us consider an `i32` value stored in 24 bits of a `BitSlice<Msb0, u8>`:
Let us consider an `i32` value stored in 24 bits of a `BitSlice<u8, Msb0>`:

@@ -95,3 +95,3 @@ ```rust

let data = [
let raw = [
// Bit index 14 ←

@@ -111,11 +111,11 @@ // Lsb0: ─┤

assert_eq!(
data.view_bits::<Lsb0>()
[14 .. 20]
.load_le::<u8>(),
raw.view_bits::<Lsb0>()
[14 .. 20]
.load_le::<u8>(),
0b00_1110_01,
);
assert_eq!(
data.view_bits::<Msb0>()
[14 .. 20]
.load_le::<u8>(),
raw.view_bits::<Msb0>()
[14 .. 20]
.load_le::<u8>(),
0b00_0001_11,

@@ -122,0 +122,0 @@ );

@@ -25,15 +25,15 @@ # `Lsb0` Big-Endian Integer Loading

let data = 0b00_10110_0u8;
let raw = 0b00_10110_0u8;
// 76 54321 0
// ^ sign bit
assert_eq!(
data.view_bits::<Lsb0>()
[1 .. 6]
.load_be::<u8>(),
raw.view_bits::<Lsb0>()
[1 .. 6]
.load_be::<u8>(),
0b000_10110,
);
assert_eq!(
data.view_bits::<Lsb0>()
[1 .. 6]
.load_be::<i8>(),
raw.view_bits::<Lsb0>()
[1 .. 6]
.load_be::<i8>(),
0b111_10110u8 as i8,

@@ -49,3 +49,3 @@ );

let data = [
let raw = [
0b0010_1111u8,

@@ -60,5 +60,5 @@ // ^ sign bit

assert_eq!(
data.view_bits::<Lsb0>()
[4 .. 20]
.load_be::<u16>(),
raw.view_bits::<Lsb0>()
[4 .. 20]
.load_be::<u16>(),
0x2018u16,

@@ -65,0 +65,0 @@ );

@@ -25,15 +25,15 @@ # `Lsb0` Little-Endian Integer Loading

let data = 0b00_10110_0u8;
let raw = 0b00_10110_0u8;
// 76 54321 0
// ^ sign bit
assert_eq!(
data.view_bits::<Lsb0>()
[1 .. 6]
.load_le::<u8>(),
raw.view_bits::<Lsb0>()
[1 .. 6]
.load_le::<u8>(),
0b000_10110,
);
assert_eq!(
data.view_bits::<Lsb0>()
[1 .. 6]
.load_le::<i8>(),
raw.view_bits::<Lsb0>()
[1 .. 6]
.load_le::<i8>(),
0b111_10110u8 as i8,

@@ -49,3 +49,3 @@ );

let data = [
let raw = [
0x8_Fu8,

@@ -60,5 +60,5 @@ // 7 0

assert_eq!(
data.view_bits::<Lsb0>()
[4 .. 20]
.load_le::<u16>(),
raw.view_bits::<Lsb0>()
[4 .. 20]
.load_le::<u16>(),
0x2018u16,

@@ -65,0 +65,0 @@ );

@@ -25,12 +25,12 @@ # `Lsb0` Big-Endian Integer Storing

let mut data = 0u8;
data.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_be(22u8);
assert_eq!(data, 0b00_10110_0);
let mut raw = 0u8;
raw.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_be(22u8);
assert_eq!(raw, 0b00_10110_0);
// 76 54321 0
data.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_be(-10i8);
assert_eq!(data, 0b00_10110_0);
raw.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_be(-10i8);
assert_eq!(raw, 0b00_10110_0);
```

@@ -44,7 +44,7 @@

let mut data = [!0u8; 3];
data.view_bits_mut::<Lsb0>()
[4 .. 20]
.store_be(0x2018u16);
assert_eq!(data, [
let mut raw = [!0u8; 3];
raw.view_bits_mut::<Lsb0>()
[4 .. 20]
.store_be(0x2018u16);
assert_eq!(raw, [
0x2_F,

@@ -51,0 +51,0 @@ // 7 0

@@ -25,12 +25,12 @@ # `Lsb0` Little-Endian Integer Storing

let mut data = 0u8;
data.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_le(22u8);
assert_eq!(data, 0b00_10110_0);
let mut raw = 0u8;
raw.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_le(22u8);
assert_eq!(raw, 0b00_10110_0);
// 76 54321 0
data.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_le(-10i8);
assert_eq!(data, 0b00_10110_0);
raw.view_bits_mut::<Lsb0>()
[1 .. 6]
.store_le(-10i8);
assert_eq!(raw, 0b00_10110_0);
```

@@ -44,7 +44,7 @@

let mut data = [!0u8; 3];
data.view_bits_mut::<Lsb0>()
[4 .. 20]
.store_le(0x2018u16);
assert_eq!(data, [
let mut raw = [!0u8; 3];
raw.view_bits_mut::<Lsb0>()
[4 .. 20]
.store_le(0x2018u16);
assert_eq!(raw, [
0x8_F,

@@ -51,0 +51,0 @@ // 7 0

@@ -25,15 +25,15 @@ # `Msb0` Big-Endian Integer Loading

let data = 0b00_10110_0u8;
let raw = 0b00_10110_0u8;
// 01 23456 7
// ^ sign bit
assert_eq!(
data.view_bits::<Msb0>()
[2 .. 7]
.load_be::<u8>(),
raw.view_bits::<Msb0>()
[2 .. 7]
.load_be::<u8>(),
0b000_10110,
);
assert_eq!(
data.view_bits::<Msb0>()
[2 .. 7]
.load_be::<i8>(),
raw.view_bits::<Msb0>()
[2 .. 7]
.load_be::<i8>(),
0b111_10110u8 as i8,

@@ -49,3 +49,3 @@ );

let data = [
let raw = [
0b1111_0010u8,

@@ -60,5 +60,5 @@ // ^ sign bit

assert_eq!(
data.view_bits::<Msb0>()
[4 .. 20]
.load_be::<u16>(),
raw.view_bits::<Msb0>()
[4 .. 20]
.load_be::<u16>(),
0x2018u16,

@@ -65,0 +65,0 @@ );

@@ -25,15 +25,15 @@ # `Msb0` Little-Endian Integer Loading

let data = 0b00_10110_0u8;
let raw = 0b00_10110_0u8;
// 01 23456 7
// ^ sign bit
assert_eq!(
data.view_bits::<Msb0>()
[2 .. 7]
.load_le::<u8>(),
raw.view_bits::<Msb0>()
[2 .. 7]
.load_le::<u8>(),
0b000_10110,
);
assert_eq!(
data.view_bits::<Msb0>()
[2 .. 7]
.load_le::<i8>(),
raw.view_bits::<Msb0>()
[2 .. 7]
.load_le::<i8>(),
0b111_10110u8 as i8,

@@ -49,3 +49,3 @@ );

let data = [
let raw = [
0xF_8u8,

@@ -60,5 +60,5 @@ // 0 7

assert_eq!(
data.view_bits::<Msb0>()
[4 .. 20]
.load_le::<u16>(),
raw.view_bits::<Msb0>()
[4 .. 20]
.load_le::<u16>(),
0x2018u16,

@@ -65,0 +65,0 @@ );

@@ -25,12 +25,12 @@ # `Msb0` Big-Endian Integer Storing

let mut data = 0u8;
data.view_bits_mut::<Msb0>()
[2 .. 7]
.store_be(22u8);
assert_eq!(data, 0b00_10110_0);
let mut raw = 0u8;
raw.view_bits_mut::<Msb0>()
[2 .. 7]
.store_be(22u8);
assert_eq!(raw, 0b00_10110_0);
// 01 23456 7
data.view_bits_mut::<Msb0>()
[2 .. 7]
.store_be(-10i8);
assert_eq!(data, 0b00_10110_0);
raw.view_bits_mut::<Msb0>()
[2 .. 7]
.store_be(-10i8);
assert_eq!(raw, 0b00_10110_0);
```

@@ -44,7 +44,7 @@

let mut data = [!0u8; 3];
data.view_bits_mut::<Msb0>()
[4 .. 20]
.store_be(0x2018u16);
assert_eq!(data, [
let mut raw = [!0u8; 3];
raw.view_bits_mut::<Msb0>()
[4 .. 20]
.store_be(0x2018u16);
assert_eq!(raw, [
0xF_2,

@@ -51,0 +51,0 @@ // 0 7

@@ -25,12 +25,12 @@ # `Msb0` Little-Endian Integer Storing

let mut data = 0u8;
data.view_bits_mut::<Msb0>()
[2 .. 7]
.store_le(22u8);
assert_eq!(data, 0b00_10110_0);
let mut raw = 0u8;
raw.view_bits_mut::<Msb0>()
[2 .. 7]
.store_le(22u8);
assert_eq!(raw, 0b00_10110_0);
// 01 23456 7
data.view_bits_mut::<Msb0>()
[2 .. 7]
.store_le(-10i8);
assert_eq!(data, 0b00_10110_0);
raw.view_bits_mut::<Msb0>()
[2 .. 7]
.store_le(-10i8);
assert_eq!(raw, 0b00_10110_0);
```

@@ -44,7 +44,7 @@

let mut data = [!0u8; 3];
data.view_bits_mut::<Msb0>()
[4 .. 20]
.store_le(0x2018u16);
assert_eq!(data, [
let mut raw = [!0u8; 3];
raw.view_bits_mut::<Msb0>()
[4 .. 20]
.store_le(0x2018u16);
assert_eq!(raw, [
0xF_8,

@@ -51,0 +51,0 @@ // 0 7

@@ -92,3 +92,3 @@ # Big-Endian Integer Storing

let data = [
let raw = [
// Bit index 14 ←

@@ -108,11 +108,11 @@ // Lsb0: ─┤

assert_eq!(
data.view_bits::<Lsb0>()
[14 .. 20]
.load_be::<u8>(),
raw.view_bits::<Lsb0>()
[14 .. 20]
.load_be::<u8>(),
0b00_01_1110,
);
assert_eq!(
data.view_bits::<Msb0>()
[14 .. 20]
.load_be::<u8>(),
raw.view_bits::<Msb0>()
[14 .. 20]
.load_be::<u8>(),
0b00_11_0001,

@@ -119,0 +119,0 @@ );

@@ -39,3 +39,3 @@ # Little-Endian Integer Storing

Let us consider an `i32` value stored in 24 bits of a `BitSlice<Msb0, u8>`:
Let us consider an `i32` value stored in 24 bits of a `BitSlice<u8, Msb0>`:

@@ -93,3 +93,3 @@ ```rust

let data = [
let raw = [
// Bit index 14 ←

@@ -109,11 +109,11 @@ // Lsb0: ─┤

assert_eq!(
data.view_bits::<Lsb0>()
[14 .. 20]
.load_le::<u8>(),
raw.view_bits::<Lsb0>()
[14 .. 20]
.load_le::<u8>(),
0b00_1110_01,
);
assert_eq!(
data.view_bits::<Msb0>()
[14 .. 20]
.load_le::<u8>(),
raw.view_bits::<Msb0>()
[14 .. 20]
.load_le::<u8>(),
0b00_0001_11,

@@ -120,0 +120,0 @@ );

@@ -26,3 +26,3 @@ # Bit-Slice Region Constructor

writable `BitSlice`.
- `static mut`: These can be combinde to create a `&'static mut BitSlice`. It is
- `static mut`: These can be combined to create a `&'static mut BitSlice`. It is
always safe to use this reference, because the `static mut BitArray` it

@@ -55,2 +55,31 @@ creates is concealed and unreachable by any other codepath, and so the

## Safety
Rust considers all `static mut` bindings to be `unsafe` to use. While `bits!`
can prevent *some* of this unsafety by preventing direct access to the created
`static mut` buffer, there are still ways to create multiple names referring to
the same underlying buffer.
```rust,ignore
use bitvec::prelude::*;
fn unsound() -> &'static mut BitSlice<usize, Lsb0> {
unsafe { bits![static mut 0; 64] }
}
let a = unsound();
let b = unsound();
```
The two names `a` and `b` can be used to produce aliasing `&mut [usize]`
references.
**You must not invoke `bits![static mut …]` in a context where it can be used**
**to create multiple escaping names**. This, and only this, argument combination
of the macro produces a value that requires a call-site `unsafe` block to use.
If you do not use this behavior to create multiple names over the same
underlying buffer, then the macro’s expansion is safe to use, as `bitvec`’s
existing alias-protection behavior suffices.
## Examples

@@ -70,3 +99,3 @@

let d = bits![static Cell<u16>, Msb0; 1; 10];
let e = bits![static mut u32, LocalBits; 0; 15];
let e = unsafe { bits![static mut u32, LocalBits; 0; 15] };
let f = bits![RadiumU32, Msb0; 1; 20];

@@ -73,0 +102,0 @@ ```

@@ -23,2 +23,2 @@ # C-Compatible Bit Ordering

[0]: https://bitvecto-rs.github.io/bitvec/bit-ordering
[0]: https://bitvecto-rs.github.io/bitvec/memory-representation

@@ -13,2 +13,2 @@ # Least-Significant-First Bit Traversal

[0]: https://bitvecto-rs.github.com/bitvec/bit-ordering
[0]: https://bitvecto-rs.github.io/bitvec/memory-representation

@@ -13,2 +13,2 @@ # Most-Significant-First Bit Traversal

[0]: https://bitvecto-rs.github.io/bitvec/bit-ordering
[0]: https://bitvecto-rs.github.io/bitvec/memory-representation

@@ -7,3 +7,3 @@ # Bit-Slice Rendering

bit-slice as numerals. This distinction matters if you use type parameters that
differ from those presumed by your debugger (which is usually `<Msb0, u8>`).
differ from those presumed by your debugger (which is usually `<u8, Msb0>`).

@@ -10,0 +10,0 @@ The output separates the `T` elements as individual list items, and renders each

@@ -1,2 +0,2 @@

<div class="title-block" style="text-align: center;" align="center">
<div style="text-align: center;" align="center">

@@ -427,7 +427,1 @@ # `bitvec`

[`std::vector<bool>`]: https://en.cppreference.com/w/cpp/container/vector_bool
<style type="text/css">
.title-block {
text-align: center;
}
</style>

@@ -46,2 +46,3 @@ #![doc = include_str!("../doc/access.md")]

/// [`BitMask`]: crate::index::BitMask
#[inline]
fn clear_bits(&self, mask: BitMask<Self::Item>) -> Self::Item {

@@ -71,2 +72,3 @@ self.fetch_and(!mask.into_inner(), Ordering::Relaxed)

/// `1`; all others retain their original value.
#[inline]
fn set_bits(&self, mask: BitMask<Self::Item>) -> Self::Item {

@@ -96,2 +98,3 @@ self.fetch_or(mask.into_inner(), Ordering::Relaxed)

/// inverted; all others retain their original value.
#[inline]
fn invert_bits(&self, mask: BitMask<Self::Item>) -> Self::Item {

@@ -125,2 +128,3 @@ self.fetch_xor(mask.into_inner(), Ordering::Relaxed)

/// bits remain unchanged.
#[inline]
fn write_bit<O>(&self, index: BitIdx<Self::Item>, value: bool) -> bool

@@ -155,2 +159,3 @@ where O: BitOrder {

/// [`set_bits`]: Self::set_bits
#[inline]
fn get_writers(

@@ -230,2 +235,3 @@ value: bool,

#[inline]
fn load(&self) -> Self::Mem {

@@ -232,0 +238,0 @@ self.inner.load(Ordering::Relaxed)

@@ -58,2 +58,3 @@ #![doc = include_str!("../doc/array.md")]

/// ```
#[inline]
pub fn new(data: A) -> Self {

@@ -73,2 +74,3 @@ Self { data, ..Self::ZERO }

/// ```
#[inline]
pub fn into_inner(self) -> A {

@@ -79,2 +81,3 @@ self.data

/// Explicitly views the bit-array as a bit-slice.
#[inline]
pub fn as_bitslice(&self) -> &BitSlice<A::Store, O> {

@@ -85,2 +88,3 @@ self.data.view_bits::<O>()

/// Explicitly views the bit-array as a mutable bit-slice.
#[inline]
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<A::Store, O> {

@@ -91,2 +95,3 @@ self.data.view_bits_mut::<O>()

/// Views the bit-array as a slice of its underlying memory elements.
#[inline]
pub fn as_raw_slice(&self) -> &[A::Store] {

@@ -98,2 +103,3 @@ self.data.as_raw_slice()

/// elements.
#[inline]
pub fn as_raw_mut_slice(&mut self) -> &mut [A::Store] {

@@ -106,2 +112,3 @@ self.data.as_raw_mut_slice()

/// This method is a compile-time constant.
#[inline]
pub fn len(&self) -> usize {

@@ -114,2 +121,3 @@ mem::bits_of::<A>()

/// This method is a compile-time constant.
#[inline]
pub fn is_empty(&self) -> bool {

@@ -116,0 +124,0 @@ mem::bits_of::<A>() == 0

@@ -28,2 +28,3 @@ #![doc = include_str!("../../doc/array/api.md")]

/// [`.as_raw_slice()`]: Self::as_raw_slice
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -49,2 +50,3 @@ #[deprecated = "use `.as_bitslice()` or `.as_raw_slice()` instead"]

/// [`.as_raw_mut_slice()`]: Self::as_raw_mut_slice
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -51,0 +53,0 @@ #[deprecated = "use `.as_mut_bitslice()` or `.as_raw_mut_slice()` instead"]

@@ -34,2 +34,3 @@ #![doc = include_str!("../../doc/array/iter.md")]

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -50,2 +51,3 @@ IntoIter::new(self)

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -66,2 +68,3 @@ self.as_bitslice().into_iter()

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -102,2 +105,3 @@ self.as_mut_bitslice().into_iter()

/// [`IntoIter::new`](core::array::IntoIter::new)s
#[inline]
pub fn new(array: BitArray<A, O>) -> Self {

@@ -115,2 +119,3 @@ Self {

/// [`IntoIter::as_slice`](core::array::IntoIter::as_slice)
#[inline]
pub fn as_bitslice(&self) -> &BitSlice<A::Store, O> {

@@ -120,2 +125,3 @@ unsafe { self.array.as_bitslice().get_unchecked(self.alive.clone()) }

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -133,2 +139,3 @@ #[deprecated = "use `.as_bitslice()` instead"]

/// [`IntoIter::as_mut_slice`](core::array::IntoIter::as_mut_slice)
#[inline]
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<A::Store, O> {

@@ -142,2 +149,3 @@ unsafe {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -151,2 +159,3 @@ #[deprecated = "use `.as_bitslice_mut()` instead"]

/// Gets a bit from the bit-array.
#[inline]
fn get(&self, index: usize) -> bool {

@@ -169,2 +178,3 @@ unsafe {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -186,2 +196,3 @@ fmt.debug_tuple("IntoIter")

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -191,2 +202,3 @@ self.alive.next().map(|idx| self.get(idx))

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -202,2 +214,3 @@ self.alive.nth(n).map(|idx| self.get(idx))

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -207,2 +220,3 @@ self.alive.next_back().map(|idx| self.get(idx))

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -218,2 +232,3 @@ self.alive.nth_back(n).map(|idx| self.get(idx))

{
#[inline]
fn len(&self) -> usize {

@@ -220,0 +235,0 @@ self.alive.len()

@@ -31,2 +31,3 @@ //! Operator trait implementations for bit-arrays.

{
#[inline]
fn bitand_assign(&mut self, rhs: BitArray<A, O>) {

@@ -43,2 +44,3 @@ *self &= rhs.as_bitslice()

{
#[inline]
fn bitand_assign(&mut self, rhs: &BitArray<A, O>) {

@@ -57,2 +59,3 @@ *self &= rhs.as_bitslice()

#[inline]
fn bitand(mut self, rhs: Rhs) -> Self::Output {

@@ -70,2 +73,3 @@ self &= rhs;

{
#[inline]
fn bitand_assign(&mut self, rhs: Rhs) {

@@ -82,2 +86,3 @@ *self.as_mut_bitslice() &= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: BitArray<A, O>) {

@@ -94,2 +99,3 @@ *self |= rhs.as_bitslice()

{
#[inline]
fn bitor_assign(&mut self, rhs: &BitArray<A, O>) {

@@ -108,2 +114,3 @@ *self |= rhs.as_bitslice()

#[inline]
fn bitor(mut self, rhs: Rhs) -> Self::Output {

@@ -121,2 +128,3 @@ self |= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: Rhs) {

@@ -133,2 +141,3 @@ *self.as_mut_bitslice() |= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: BitArray<A, O>) {

@@ -145,2 +154,3 @@ *self ^= rhs.as_bitslice()

{
#[inline]
fn bitxor_assign(&mut self, rhs: &BitArray<A, O>) {

@@ -159,2 +169,3 @@ *self ^= rhs.as_bitslice()

#[inline]
fn bitxor(mut self, rhs: Rhs) -> Self::Output {

@@ -172,2 +183,3 @@ self ^= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: Rhs) {

@@ -185,2 +197,3 @@ *self.as_mut_bitslice() ^= rhs;

#[inline]
fn deref(&self) -> &Self::Target {

@@ -196,2 +209,3 @@ self.as_bitslice()

{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {

@@ -210,2 +224,3 @@ self.as_mut_bitslice()

#[inline]
fn index(&self, index: Idx) -> &Self::Output {

@@ -222,2 +237,3 @@ &self.as_bitslice()[index]

{
#[inline]
fn index_mut(&mut self, index: Idx) -> &mut Self::Output {

@@ -235,2 +251,3 @@ &mut self.as_mut_bitslice()[index]

#[inline]
fn not(mut self) -> Self::Output {

@@ -237,0 +254,0 @@ for elem in self.as_raw_mut_slice() {

@@ -94,4 +94,4 @@ //! Unit tests for bit-arrays.

let _: &BitSlice = &*a;
let _: &mut BitSlice = &mut *f;
let _: &BitSlice = &a;
let _: &mut BitSlice = &mut f;
}

@@ -98,0 +98,0 @@

@@ -41,2 +41,3 @@ //! Additional trait implementations on bit-arrays.

{
#[inline]
fn borrow(&self) -> &BitSlice<A::Store, O> {

@@ -53,2 +54,3 @@ self.as_bitslice()

{
#[inline]
fn borrow_mut(&mut self) -> &mut BitSlice<A::Store, O> {

@@ -64,2 +66,3 @@ self.as_mut_bitslice()

{
#[inline]
fn clone(&self) -> Self {

@@ -89,2 +92,3 @@ let mut out = Self::ZERO;

{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {

@@ -103,2 +107,3 @@ self.as_bitslice().cmp(other.as_bitslice())

{
#[inline]
fn eq(&self, other: &BitArray<A, O2>) -> bool {

@@ -117,2 +122,3 @@ self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &Rhs) -> bool {

@@ -130,2 +136,3 @@ self.as_bitslice() == other

{
#[inline]
fn partial_cmp(&self, other: &BitArray<A, O>) -> Option<cmp::Ordering> {

@@ -144,2 +151,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &Rhs) -> Option<cmp::Ordering> {

@@ -156,2 +164,3 @@ self.as_bitslice().partial_cmp(other)

{
#[inline]
fn as_ref(&self) -> &BitSlice<A::Store, O> {

@@ -168,2 +177,3 @@ self.as_bitslice()

{
#[inline]
fn as_mut(&mut self) -> &mut BitSlice<A::Store, O> {

@@ -180,2 +190,3 @@ self.as_mut_bitslice()

{
#[inline]
fn from(data: A) -> Self {

@@ -193,2 +204,3 @@ Self::new(data)

#[inline]
fn try_from(src: &BitSlice<A::Store, O>) -> Result<Self, Self::Error> {

@@ -206,2 +218,3 @@ src.try_conv::<&Self>().map(|this| this.clone())

#[inline]
fn try_from(src: &BitSlice<A::Store, O>) -> Result<Self, Self::Error> {

@@ -225,2 +238,3 @@ TryFromBitSliceError::new::<A, O>(src).map(|()| unsafe {

#[inline]
fn try_from(src: &mut BitSlice<A::Store, O>) -> Result<Self, Self::Error> {

@@ -242,2 +256,3 @@ TryFromBitSliceError::new::<A, O>(src).map(|()| unsafe {

{
#[inline]
fn default() -> Self {

@@ -253,2 +268,3 @@ Self::ZERO

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -276,2 +292,3 @@ self.as_bitspan().render(fmt, "Array", None)?;

{
#[inline]
fn hash<H>(&self, hasher: &mut H)

@@ -304,2 +321,3 @@ where H: Hasher {

/// Checks whether a bit-slice can be viewed as a bit-array.
#[inline]
fn new<A, O>(bits: &BitSlice<A::Store, O>) -> Result<(), Self>

@@ -315,2 +333,3 @@ where

impl Debug for TryFromBitSliceError {
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -329,2 +348,3 @@ fmt.write_str("TryFromBitSliceError::")?;

impl Display for TryFromBitSliceError {
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -365,2 +385,3 @@ match self.0 {

/// Checks whether a bit-slice is suitable to view as a bit-array.
#[inline]
fn new<A, O>(bits: &BitSlice<A::Store, O>) -> Result<(), Self>

@@ -367,0 +388,0 @@ where

@@ -87,2 +87,3 @@ #![cfg(feature = "alloc")]

/// [`.force_align()`]: Self::force_align
#[inline]
pub fn from_bitslice(slice: &BitSlice<T, O>) -> Self {

@@ -113,2 +114,3 @@ BitVec::from_bitslice(slice).into_boxed_bitslice()

/// ```
#[inline]
pub fn from_boxed_slice(boxed: Box<[T]>) -> Self {

@@ -143,2 +145,3 @@ Self::try_from_boxed_slice(boxed)

/// [`MAX_ELTS`]: crate::slice::BitSlice::MAX_ELTS
#[inline]
pub fn try_from_boxed_slice(boxed: Box<[T]>) -> Result<Self, Box<[T]>> {

@@ -169,2 +172,3 @@ let mut boxed = ManuallyDrop::new(boxed);

/// ```
#[inline]
pub fn into_boxed_slice(self) -> Box<[T]> {

@@ -207,2 +211,3 @@ self.pipe(ManuallyDrop::new)

/// [0]: crate::vec::BitVec::into_boxed_bitslice
#[inline]
pub fn into_bitvec(self) -> BitVec<T, O> {

@@ -229,2 +234,3 @@ let bitspan = self.bitspan;

/// Explicitly views the bit-box as a bit-slice.
#[inline]
pub fn as_bitslice(&self) -> &BitSlice<T, O> {

@@ -235,2 +241,3 @@ unsafe { self.bitspan.into_bitslice_ref() }

/// Explicitly views the bit-box as a mutable bit-slice.
#[inline]
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<T, O> {

@@ -244,2 +251,3 @@ unsafe { self.bitspan.into_bitslice_mut() }

/// underlying buffer without dealing with contending neighbors.
#[inline]
pub fn as_raw_slice(&self) -> &[T] {

@@ -255,2 +263,3 @@ let (data, len) =

/// underlying buffer without dealing with contending neighbors.
#[inline]
pub fn as_raw_mut_slice(&mut self) -> &mut [T] {

@@ -293,2 +302,3 @@ let (data, len) =

/// ```
#[inline]
pub fn fill_uninitialized(&mut self, value: bool) {

@@ -337,2 +347,3 @@ let (_, head, bits) = self.bitspan.raw_parts();

/// [`.fill_uninitialized()`]: Self::fill_uninitialized
#[inline]
pub fn force_align(&mut self) {

@@ -357,2 +368,3 @@ let head = self.bitspan.head();

/// `Box` is written back into `self` and forgotten.
#[inline]
fn with_box<F, R>(&mut self, func: F) -> R

@@ -359,0 +371,0 @@ where F: FnOnce(&mut ManuallyDrop<Box<[T]>>) -> R {

@@ -59,2 +59,3 @@ //! Port of the `Box<[T]>` inherent API.

/// [`::leak()`]: Self::leak
#[inline]
pub unsafe fn from_raw(raw: *mut BitSlice<T, O>) -> Self {

@@ -92,2 +93,3 @@ Self {

/// [`::from_raw()`]: Self::from_raw
#[inline]
pub fn into_raw(this: Self) -> *mut BitSlice<T, O> {

@@ -126,2 +128,3 @@ Self::leak(this)

/// [`::into_raw()`]: Self::into_raw
#[inline]
pub fn leak<'a>(this: Self) -> &'a mut BitSlice<T, O>

@@ -132,2 +135,3 @@ where T: 'a {

#[inline]
#[doc(hidden)]

@@ -134,0 +138,0 @@ #[cfg(not(tarpaulin_include))]

@@ -32,2 +32,3 @@ #![doc = include_str!("../../doc/boxed/iter.md")]

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -62,2 +63,3 @@ IntoIter::new(self)

/// Wraps a bit-array in an iterator view. This is irreversible.
#[inline]
fn new(this: BitBox<T, O>) -> Self {

@@ -73,2 +75,3 @@ let iter = 0 .. this.len();

/// [`IntoIter::as_slice`](alloc::vec::IntoIter::as_slice)
#[inline]
pub fn as_bitslice(&self) -> &BitSlice<T, O> {

@@ -86,2 +89,3 @@ // While the memory is never actually deïnitialized, this is still a

#[inline]
#[doc(hidden)]

@@ -100,2 +104,3 @@ #[cfg(not(tarpaulin_include))]

/// [`IntoIter::as_mut_slice`](alloc::vec::IntoIter::as_mut_slice)
#[inline]
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<T, O> {

@@ -111,2 +116,3 @@ unsafe {

#[inline]
#[doc(hidden)]

@@ -128,2 +134,3 @@ #[cfg(not(tarpaulin_include))]

{
#[inline]
fn as_ref(&self) -> &BitSlice<T, O> {

@@ -140,2 +147,3 @@ self.as_bitslice()

{
#[inline]
fn clone(&self) -> Self {

@@ -156,2 +164,3 @@ Self {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -173,2 +182,3 @@ fmt.debug_tuple("IntoIter")

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -180,2 +190,3 @@ self.iter

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -193,2 +204,3 @@ self.iter

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -200,2 +212,3 @@ self.iter

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -213,2 +226,3 @@ self.iter

{
#[inline]
fn len(&self) -> usize {

@@ -215,0 +229,0 @@ self.iter.len()

@@ -33,2 +33,3 @@ //! Operator trait implementations for boxed bit-slices.

{
#[inline]
fn bitand_assign(&mut self, rhs: BitBox<T, O>) {

@@ -45,2 +46,3 @@ *self &= rhs.as_bitslice()

{
#[inline]
fn bitand_assign(&mut self, rhs: &BitBox<T, O>) {

@@ -59,2 +61,3 @@ *self &= rhs.as_bitslice()

#[inline]
fn bitand(mut self, rhs: Rhs) -> Self::Output {

@@ -72,2 +75,3 @@ self &= rhs;

{
#[inline]
fn bitand_assign(&mut self, rhs: Rhs) {

@@ -84,2 +88,3 @@ *self.as_mut_bitslice() &= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: BitBox<T, O>) {

@@ -96,2 +101,3 @@ *self |= rhs.as_bitslice()

{
#[inline]
fn bitor_assign(&mut self, rhs: &BitBox<T, O>) {

@@ -110,2 +116,3 @@ *self |= rhs.as_bitslice()

#[inline]
fn bitor(mut self, rhs: Rhs) -> Self::Output {

@@ -123,2 +130,3 @@ self |= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: Rhs) {

@@ -135,2 +143,3 @@ *self.as_mut_bitslice() |= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: BitBox<T, O>) {

@@ -147,2 +156,3 @@ *self ^= rhs.as_bitslice()

{
#[inline]
fn bitxor_assign(&mut self, rhs: &BitBox<T, O>) {

@@ -161,2 +171,3 @@ *self ^= rhs.as_bitslice()

#[inline]
fn bitxor(mut self, rhs: Rhs) -> Self::Output {

@@ -174,2 +185,3 @@ self ^= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: Rhs) {

@@ -187,2 +199,3 @@ *self.as_mut_bitslice() ^= rhs;

#[inline]
fn deref(&self) -> &Self::Target {

@@ -198,2 +211,3 @@ self.as_bitslice()

{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {

@@ -209,2 +223,3 @@ self.as_mut_bitslice()

{
#[inline]
fn drop(&mut self) {

@@ -224,2 +239,3 @@ self.with_box(|b| unsafe { ManuallyDrop::drop(b) })

#[inline]
fn index(&self, index: Idx) -> &Self::Output {

@@ -237,2 +253,3 @@ &self.as_bitslice()[index]

{
#[inline]
fn index_mut(&mut self, index: Idx) -> &mut Self::Output {

@@ -250,2 +267,3 @@ &mut self.as_mut_bitslice()[index]

#[inline]
fn not(mut self) -> Self::Output {

@@ -252,0 +270,0 @@ for elem in self.as_raw_mut_slice().iter_mut() {

@@ -170,4 +170,4 @@ //! Unit tests for boxed bit-slices.

let _: &BitSlice = &*a;
let _: &mut BitSlice = &mut *f;
let _: &BitSlice = &a;
let _: &mut BitSlice = &mut f;
}

@@ -174,0 +174,0 @@

@@ -45,2 +45,3 @@ //! General trait implementations for boxed bit-slices.

{
#[inline]
fn borrow(&self) -> &BitSlice<T, O> {

@@ -57,2 +58,3 @@ self.as_bitslice()

{
#[inline]
fn borrow_mut(&mut self) -> &mut BitSlice<T, O> {

@@ -69,2 +71,3 @@ self.as_mut_bitslice()

{
#[inline]
fn clone(&self) -> Self {

@@ -89,2 +92,3 @@ self.as_bitslice().pipe(Self::from_bitslice)

{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {

@@ -103,2 +107,3 @@ self.as_bitslice().cmp(other.as_bitslice())

{
#[inline]
fn eq(&self, other: &BitBox<T2, O2>) -> bool {

@@ -117,2 +122,3 @@ self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &BitBox<T2, O2>) -> bool {

@@ -131,2 +137,3 @@ *self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &BitBox<T2, O2>) -> bool {

@@ -144,2 +151,3 @@ **self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &Rhs) -> bool {

@@ -158,2 +166,3 @@ other == self.as_bitslice()

{
#[inline]
fn partial_cmp(&self, other: &BitBox<T2, O2>) -> Option<cmp::Ordering> {

@@ -171,2 +180,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &Rhs) -> Option<cmp::Ordering> {

@@ -185,2 +195,3 @@ other.partial_cmp(self.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &BitBox<T2, O2>) -> Option<cmp::Ordering> {

@@ -199,2 +210,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &BitBox<T2, O2>) -> Option<cmp::Ordering> {

@@ -211,2 +223,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn as_ref(&self) -> &BitSlice<T, O> {

@@ -223,2 +236,3 @@ self.as_bitslice()

{
#[inline]
fn as_mut(&mut self) -> &mut BitSlice<T, O> {

@@ -234,2 +248,3 @@ self.as_mut_bitslice()

{
#[inline]
fn from(slice: &BitSlice<T, O>) -> Self {

@@ -245,2 +260,3 @@ slice.pipe(Self::from_bitslice)

{
#[inline]
fn from(array: BitArray<A, O>) -> Self {

@@ -256,2 +272,3 @@ array.as_bitslice().pipe(Self::from_bitslice)

{
#[inline]
fn from(elem: Box<T>) -> Self {

@@ -270,2 +287,3 @@ unsafe {

{
#[inline]
fn from(cow: Cow<'a, BitSlice<T, O>>) -> Self {

@@ -281,2 +299,3 @@ cow.into_owned().into_boxed_bitslice()

{
#[inline]
fn from(bv: BitVec<T, O>) -> Self {

@@ -292,2 +311,3 @@ bv.into_boxed_bitslice()

{
#[inline]
fn from(bb: BitBox<T, O>) -> Self {

@@ -305,2 +325,3 @@ bb.into_boxed_slice()

#[inline]
fn try_from(boxed: Box<[T]>) -> Result<Self, Self::Error> {

@@ -316,2 +337,3 @@ Self::try_from_boxed_slice(boxed)

{
#[inline]
fn default() -> Self {

@@ -327,2 +349,3 @@ Self::from_bitslice(BitSlice::<T, O>::empty())

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -352,2 +375,3 @@ self.bitspan.render(fmt, "Box", None)?;

{
#[inline]
fn from_iter<II>(iter: II) -> Self

@@ -365,2 +389,3 @@ where II: IntoIterator<Item = I> {

{
#[inline]
fn hash<H>(&self, state: &mut H)

@@ -367,0 +392,0 @@ where H: Hasher {

@@ -18,2 +18,3 @@ //! Support utilities for crate development.

{
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -31,2 +32,3 @@ fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {

{
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -43,2 +45,3 @@ fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {

() => {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {

@@ -49,2 +52,3 @@ let len = self.len();

#[inline]
fn count(self) -> usize {

@@ -54,2 +58,3 @@ self.len()

#[inline]
fn last(mut self) -> Option<Self::Item> {

@@ -62,2 +67,3 @@ self.next_back()

/// Tests if two `BitOrder` implementors are the same.
#[inline]
pub fn match_order<O, P>() -> bool

@@ -72,2 +78,3 @@ where

/// Tests if two `BitStore` implementors are the same.
#[inline]
pub fn match_store<T, U>() -> bool

@@ -82,2 +89,3 @@ where

/// Tests if two `BitSlice` type parameter pairs match each other.
#[inline]
pub fn match_types<T1, O1, T2, O2>() -> bool

@@ -96,2 +104,3 @@ where

/// Returns `true` for `u{8,16,32,64,128,size}` and `false` for all others.
#[inline]
pub fn is_unsigned<T>() -> bool

@@ -108,2 +117,3 @@ where T: 'static {

/// Tests if two types are identical, even through different names.
#[inline]
fn eq_types<T, U>() -> bool

@@ -110,0 +120,0 @@ where

@@ -126,2 +126,3 @@ #![doc = include_str!("../doc/domain.md")]

/// [`Enclave`]: Self::Enclave
#[inline]
pub fn enclave(self) -> Option<Reference<'a, M, BitSlice<T, O>>> {

@@ -138,2 +139,3 @@ match self {

/// [`Region`]: Self::Region
#[inline]
pub fn region(

@@ -163,2 +165,3 @@ self,

{
#[inline]
fn default() -> Self {

@@ -183,2 +186,3 @@ Self::Region {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -212,2 +216,3 @@ write!(

{
#[inline]
fn clone(&self) -> Self {

@@ -277,2 +282,3 @@ *self

/// [`Enclave`]: Self::Enclave
#[inline]
pub fn enclave(self) -> Option<PartialElement<'a, M, T, O>> {

@@ -289,2 +295,3 @@ match self {

/// [`Region`]: Self::Region
#[inline]
pub fn region(

@@ -307,2 +314,3 @@ self,

/// `BitSlice` reference.
#[inline]
pub fn into_bit_domain(self) -> BitDomain<'a, M, T, O>

@@ -323,6 +331,19 @@ where

),
body: body
.try_into()
.map_err(drop)
.expect("this conversion will never fail"),
body: body.try_into().unwrap_or_else(|_| {
match option_env!("CARGO_PKG_REPOSITORY") {
Some(env) => unreachable!(
"Construction of a slice with length {} should not \
be possible. If this assumption is outdated, \
please file an issue at {}",
(isize::MIN as usize) >> 3,
env,
),
None => unreachable!(
"Construction of a slice with length {} should not \
be possible. If this assumption is outdated, \
please consider filing an issue",
(isize::MIN as usize) >> 3
),
}
}),
tail: tail.map_or_else(

@@ -384,2 +405,3 @@ Default::default,

/// Produces the canonical empty `Domain`.
#[inline]
fn empty(

@@ -396,2 +418,3 @@ _: Address<M, T>,

/// elements as well as a `body` slice (which may be empty).
#[inline]
fn major(

@@ -419,2 +442,3 @@ addr: Address<M, T>,

/// Produces a `Domain::Enclave`.
#[inline]
fn minor(

@@ -432,2 +456,3 @@ addr: Address<M, T>,

/// `tail`.
#[inline]
fn partial_head(

@@ -455,2 +480,3 @@ addr: Address<M, T>,

/// `head`.
#[inline]
fn partial_tail(

@@ -478,2 +504,3 @@ addr: Address<M, T>,

/// `body`.
#[inline]
fn spanning(

@@ -507,2 +534,3 @@ addr: Address<M, T>,

{
#[inline]
fn default() -> Self {

@@ -526,2 +554,3 @@ Self::Region {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -555,2 +584,3 @@ write!(

{
#[inline]
fn clone(&self) -> Self {

@@ -568,2 +598,3 @@ *self

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -596,2 +627,3 @@ match self {

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -624,2 +656,3 @@ match self {

{
#[inline]
fn len(&self) -> usize {

@@ -657,2 +690,3 @@ match self {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -717,2 +751,3 @@ fmt.debug_list()

/// - `tail`: the index at which the partial region ends.
#[inline]
fn new(

@@ -743,2 +778,3 @@ elem: Address<M, T>,

/// bits are cleared to `0`.
#[inline]
pub fn load_value(&self) -> T::Mem {

@@ -752,2 +788,3 @@ self.elem

/// Gets the starting index of the live bits in the element.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -759,2 +796,3 @@ pub fn head(&self) -> BitIdx<T::Mem> {

/// Gets the ending index of the live bits in the element.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -767,2 +805,3 @@ pub fn tail(&self) -> BitEnd<T::Mem> {

/// referent element may be accessed.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -774,2 +813,3 @@ pub fn bounds(&self) -> (BitIdx<T::Mem>, BitEnd<T::Mem>) {

/// Gets the bit-mask over all accessible bits.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -781,2 +821,3 @@ pub fn mask(&self) -> BitMask<T::Mem> {

/// Converts the partial element into a bit-slice over its governed bits.
#[inline]
pub fn into_bitslice(self) -> Reference<'a, M, BitSlice<T, O>>

@@ -814,2 +855,3 @@ where Address<M, BitSlice<T, O>>: Referential<'a> {

/// The previous value of the governed bits.
#[inline]
pub fn store_value(&mut self, value: T::Mem) -> T::Mem {

@@ -827,2 +869,3 @@ let this = self.access();

/// The previous value of the governed bits.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -838,2 +881,3 @@ pub fn invert(&mut self) -> T::Mem {

/// The previous value of the governed bits.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -849,2 +893,3 @@ pub fn clear(&mut self) -> T::Mem {

/// The previous value of the governed bits.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -857,2 +902,3 @@ pub fn set(&mut self) -> T::Mem {

/// same *memory element*.
#[inline]
fn access(&self) -> &T::Access {

@@ -871,2 +917,3 @@ unsafe { &*self.elem.to_const().cast::<T::Access>() }

/// observed by another handle.
#[inline]
pub fn store_value_aliased(&self, value: T::Mem) -> T::Mem {

@@ -887,2 +934,3 @@ let this = unsafe { &*self.elem.to_const().cast::<T::Access>() };

{
#[inline]
fn clone(&self) -> Self {

@@ -899,2 +947,3 @@ *self

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -924,2 +973,3 @@ write!(

{
#[inline]
fn hash<H>(&self, hasher: &mut H)

@@ -926,0 +976,0 @@ where H: Hasher {

#![doc = include_str!("../doc/field.md")]
use core::{
cmp,
mem,

@@ -44,2 +43,3 @@ ptr,

pub trait BitField {
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -56,9 +56,17 @@ #[doc = include_str!("../doc/field/BitField_load.md")]

else {
unreachable!(concat!(
"This architecture is not supported! Please file an issue at ",
env!("CARGO_PKG_REPOSITORY")
));
match option_env!("CARGO_PKG_REPOSITORY") {
Some(env) => unreachable!(
"This architecture is not supported! Please consider \
filing an issue at {}",
env
),
None => unreachable!(
"This architecture is not supported! Please consider \
filing an issue"
),
}
}
}
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -75,6 +83,13 @@ #[doc = include_str!("../doc/field/BitField_store.md")]

else {
unreachable!(concat!(
"This architecture is not supported! File an issue at ",
env!("CARGO_PKG_REPOSITORY")
));
match option_env!("CARGO_PKG_REPOSITORY") {
Some(env) => unreachable!(
"This architecture is not supported! Please consider \
filing an issue at {}",
env
),
None => unreachable!(
"This architecture is not supported! Please consider \
filing an issue"
),
}
}

@@ -104,2 +119,3 @@ }

{
#[inline]
#[doc = include_str!("../doc/field/BitField_Lsb0_load_le.md")]

@@ -141,2 +157,3 @@ fn load_le<I>(&self) -> I

#[inline]
#[doc = include_str!("../doc/field/BitField_Lsb0_load_be.md")]

@@ -174,2 +191,3 @@ fn load_be<I>(&self) -> I

#[inline]
#[doc = include_str!("../doc/field/BitField_Lsb0_store_le.md")]

@@ -205,2 +223,3 @@ fn store_le<I>(&mut self, mut value: I)

#[inline]
#[doc = include_str!("../doc/field/BitField_Lsb0_store_be.md")]

@@ -237,5 +256,7 @@ fn store_be<I>(&mut self, mut value: I)

#[doc = include_str!("../doc/field/BitField_Msb0.md")]
impl<T> BitField for BitSlice<T, Msb0>
where T: BitStore
{
#[inline]
#[doc = include_str!("../doc/field/BitField_Msb0_load_le.md")]

@@ -278,2 +299,3 @@ fn load_le<I>(&self) -> I

#[inline]
#[doc = include_str!("../doc/field/BitField_Msb0_load_be.md")]

@@ -314,2 +336,3 @@ fn load_be<I>(&self) -> I

#[inline]
#[doc = include_str!("../doc/field/BitField_Msb0_store_le.md")]

@@ -346,2 +369,3 @@ fn store_le<I>(&mut self, mut value: I)

#[inline]
#[doc = include_str!("../doc/field/BitField_Msb0_store_be.md")]

@@ -600,3 +624,3 @@ fn store_be<I>(&mut self, mut value: I)

dst as *mut U as *mut u8,
cmp::min(size_t, size_u),
size_t.min(size_u),
);

@@ -627,7 +651,1 @@ }

}
#[cfg(not(any(target_endian = "big", target_endian = "little")))]
compile_fail!(concat!(
"This architecture is not supported! File an issue at ",
env!("CARGO_PKG_REPOSITORY")
));

@@ -27,2 +27,3 @@ #![cfg(feature = "std")]

{
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {

@@ -48,2 +49,3 @@ let mut count = 0;

{
#[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {

@@ -63,2 +65,3 @@ let mut count = 0;

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -77,2 +80,3 @@ fn flush(&mut self) -> io::Result<()> {

{
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {

@@ -94,2 +98,3 @@ let bytes_read = self.as_bitslice().read(buf)?;

{
#[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {

@@ -101,2 +106,3 @@ let len = self.len();

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -103,0 +109,0 @@ fn flush(&mut self) -> io::Result<()> {

@@ -69,2 +69,3 @@ #![doc = include_str!("../doc/index.md")]

/// `BitIdxError` by whether it is within the valid range `0 .. R::BITS`.
#[inline]
pub fn new(idx: u8) -> Result<Self, BitIdxError<R>> {

@@ -93,2 +94,3 @@ if idx >= bits_of::<R>() as u8 {

/// value or specify a behavior.
#[inline]
pub unsafe fn new_unchecked(idx: u8) -> Self {

@@ -108,2 +110,3 @@ debug_assert!(

/// Removes the index wrapper, leaving the internal counter.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -124,2 +127,3 @@ pub fn into_inner(self) -> u8 {

/// - `.1`: Indicates whether the new index is in the next memory address.
#[inline]
pub fn next(self) -> (Self, bool) {

@@ -144,2 +148,3 @@ let next = self.idx + 1;

/// address.
#[inline]
pub fn prev(self) -> (Self, bool) {

@@ -159,2 +164,3 @@ let prev = self.idx.wrapping_sub(1);

/// [`O::at::<R>`]: crate::order::BitOrder::at
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -172,2 +178,3 @@ pub fn position<O>(self) -> BitPos<R>

/// [`O::select::<R>`]: crate::order::BitOrder::select
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -184,2 +191,3 @@ pub fn select<O>(self) -> BitSel<R>

/// [`Self::select`]: Self::select
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -216,2 +224,3 @@ pub fn mask<O>(self) -> BitMask<R>

/// [`Range<BitIdx<R>>`]: core::ops::Range
#[inline]
pub fn range(

@@ -230,2 +239,3 @@ self,

/// Iterates over all possible index values.
#[inline]
pub fn range_all() -> impl Iterator<Item = Self>

@@ -303,2 +313,3 @@ + DoubleEndedIterator

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -312,2 +323,3 @@ write!(fmt, "{:0>1$b}", self.idx, R::INDX as usize)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -321,2 +333,3 @@ write!(fmt, "BitIdx<{}>({})", any::type_name::<R>(), self)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -372,2 +385,3 @@ Binary::fmt(self, fmt)

/// Removes the error wrapper, leaving the internal counter.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -382,2 +396,3 @@ pub fn into_inner(self) -> u8 {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -392,2 +407,3 @@ write!(fmt, "BitIdxError<{}>({})", any::type_name::<R>(), self.err)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -445,2 +461,3 @@ write!(

/// and `None` when it is not.
#[inline]
pub fn new(end: u8) -> Option<Self> {

@@ -483,2 +500,3 @@ if end > bits_of::<R>() as u8 {

/// Removes the tail wrapper, leaving the internal counter.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -508,2 +526,3 @@ pub fn into_inner(self) -> u8 {

/// [`Range<BitEnd<R>>`]: core::ops::Range
#[inline]
pub fn range_from(

@@ -572,2 +591,3 @@ from: BitIdx<R>,

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -581,2 +601,3 @@ write!(fmt, "{:0>1$b}", self.end, R::INDX as usize + 1)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -590,2 +611,3 @@ write!(fmt, "BitEnd<{}>({})", any::type_name::<R>(), self)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -635,2 +657,3 @@ Binary::fmt(self, fmt)

/// and `None` when it is not.
#[inline]
pub fn new(pos: u8) -> Option<Self> {

@@ -660,2 +683,3 @@ if pos >= bits_of::<R>() as u8 {

/// value or specify a behavior.
#[inline]
pub unsafe fn new_unchecked(pos: u8) -> Self {

@@ -675,2 +699,3 @@ debug_assert!(

/// Removes the position wrapper, leaving the internal counter.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -684,2 +709,3 @@ pub fn into_inner(self) -> u8 {

/// This is always `1 << self.pos`.
#[inline]
pub fn select(self) -> BitSel<R> {

@@ -694,2 +720,3 @@ unsafe { BitSel::new_unchecked(R::ONE << self.pos) }

/// [`Self::select`]: Self::select
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -713,2 +740,3 @@ pub fn mask(self) -> BitMask<R> {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -722,2 +750,3 @@ write!(fmt, "{:0>1$b}", self.pos, R::INDX as usize)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -731,2 +760,3 @@ write!(fmt, "BitPos<{}>({})", any::type_name::<R>(), self)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -761,2 +791,3 @@ Binary::fmt(self, fmt)

/// and all others cleared), and `None` when it is not.
#[inline]
pub fn new(sel: R) -> Option<Self> {

@@ -784,2 +815,3 @@ if sel.count_ones() != 1 {

/// panic; release builds do not inspect the value or specify a behavior.
#[inline]
pub unsafe fn new_unchecked(sel: R) -> Self {

@@ -796,2 +828,3 @@ debug_assert!(

/// Removes the one-hot selection wrapper, leaving the internal mask.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -803,2 +836,3 @@ pub fn into_inner(self) -> R {

/// Computes a bit-mask for `self`. This is a type-cast.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -810,2 +844,3 @@ pub fn mask(self) -> BitMask<R> {

/// Iterates over all possible selector values.
#[inline]
pub fn range_all() -> impl Iterator<Item = Self>

@@ -822,2 +857,3 @@ + DoubleEndedIterator

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -831,2 +867,3 @@ write!(fmt, "{:0>1$b}", self.sel, bits_of::<R>() as usize)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -840,2 +877,3 @@ write!(fmt, "BitSel<{}>({})", any::type_name::<R>(), self)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -887,2 +925,3 @@ Binary::fmt(self, fmt)

/// [`BitSel`]: crate::index::BitSel
#[inline]
pub fn new(mask: R) -> Self {

@@ -893,2 +932,3 @@ Self { mask }

/// Removes the mask wrapper, leaving the internal value.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -909,2 +949,3 @@ pub fn into_inner(self) -> R {

/// Whether `self` has set the bit that `sel` indicates.
#[inline]
pub fn test(&self, sel: BitSel<R>) -> bool {

@@ -924,2 +965,3 @@ self.mask & sel.sel != R::ZERO

/// The `sel` bit is set in the mask.
#[inline]
pub fn insert(&mut self, sel: BitSel<R>) {

@@ -939,2 +981,3 @@ self.mask |= sel.sel;

/// A new bit-mask with `sel` activated.
#[inline]
pub fn combine(self, sel: BitSel<R>) -> Self {

@@ -950,2 +993,3 @@ Self {

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -959,2 +1003,3 @@ write!(fmt, "{:0>1$b}", self.mask, bits_of::<R>() as usize)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -968,2 +1013,3 @@ write!(fmt, "BitMask<{}>({})", any::type_name::<R>(), self)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -977,2 +1023,3 @@ Binary::fmt(self, fmt)

{
#[inline]
fn sum<I>(iter: I) -> Self

@@ -989,2 +1036,3 @@ where I: Iterator<Item = BitSel<R>> {

#[inline]
fn bitand(self, rhs: R) -> Self::Output {

@@ -1002,2 +1050,3 @@ Self {

#[inline]
fn bitor(self, rhs: R) -> Self::Output {

@@ -1015,2 +1064,3 @@ Self {

#[inline]
fn not(self) -> Self::Output {

@@ -1017,0 +1067,0 @@ Self { mask: !self.mask }

@@ -175,3 +175,3 @@ #![allow(deprecated)]

$crate::bitarr!(const Cell<$store>, $order; $val; $len);
unsafe { &mut DATA[.. $len] }
&mut DATA[.. $len]
}};

@@ -181,3 +181,3 @@ (static mut $store:ident, $order:ident; $val:expr; $len:expr) => {{

$crate::bitarr!(const $store, $order; $val; $len);
unsafe { DATA.get_unchecked_mut(.. $len) }
DATA.get_unchecked_mut(.. $len)
}};

@@ -192,9 +192,7 @@

$crate::bitarr!(const $store, $order; $($val),*);
unsafe {
&mut *(
DATA.get_unchecked_mut(.. BITS)
as *mut $crate::slice::BitSlice<$store, $order>
as *mut $crate::slice::BitSlice<Celled, $order>
)
}
&mut *(
DATA.get_unchecked_mut(.. BITS)
as *mut $crate::slice::BitSlice<$store, $order>
as *mut $crate::slice::BitSlice<Celled, $order>
)
}};

@@ -205,3 +203,3 @@ (static mut $store:ident, $order:ident; $($val:expr),* $(,)?) => {{

$crate::bitarr!(const $store, $order; $($val),*);
unsafe { DATA.get_unchecked_mut(.. BITS) }
DATA.get_unchecked_mut(.. BITS)
}};

@@ -212,3 +210,3 @@

$crate::bitarr!(const usize, $crate::order::Lsb0; $val; $len);
unsafe { DATA.get_unchecked_mut(.. $len) }
DATA.get_unchecked_mut(.. $len)
}};

@@ -237,7 +235,7 @@ (static mut $($val:expr),* $(,)?) => {{

static mut DATA: $crate::BitArr!(for BITS, in $store, $order) =
static DATA: $crate::BitArr!(for BITS, in $store, $order) =
$crate::bitarr!(const $store, $order; $($val),*);
unsafe {
&*(
DATA.get_unchecked_mut(.. BITS)
DATA.get_unchecked(.. BITS)
as *const $crate::slice::BitSlice<$store, $order>

@@ -351,2 +349,10 @@ as *const $crate::slice::BitSlice<Celled, $order>

};
// Capture `Cell<T>` patterns and prevent them from being parsed as
// comparisons. Guess we didn't escape Most Vexing Parse after all.
(Cell<$store:ident>, $order:ident $($rest:tt)*) => {
$crate::vec::BitVec::from_bitslice($crate::bits!(Cell<$store>, $order $($rest)*))
};
($val:expr; $len:expr) => {
$crate::bitvec!(usize, $crate::order::Lsb0; $val; $len)
};

@@ -353,0 +359,0 @@ // Delegate all others to the `bits!` macro.

@@ -70,11 +70,12 @@ //! Invocation tests of each supported constructor-macro syntax.

let _: &'static mut BitSlice<Cell<u16>, Msb0> =
bits!(static mut Cell<u16>, Msb0; 1; 20);
let _: &'static mut BitSlice<u32, Lsb0> = bits!(static mut u32, Lsb0; 1; 20);
let _: &'static mut BitSlice = bits!(static mut 1; 20);
unsafe { bits!(static mut Cell<u16>, Msb0; 1; 20) };
let _: &'static mut BitSlice<u32, Lsb0> =
unsafe { bits!(static mut u32, Lsb0; 1; 20) };
let _: &'static mut BitSlice = unsafe { bits!(static mut 1; 20) };
let _: &'static mut BitSlice<Cell<u16>, Msb0> =
bits!(static mut Cell<u16>, Msb0; 1, 0, 1, 1, 0);
unsafe { bits!(static mut Cell<u16>, Msb0; 1, 0, 1, 1, 0) };
let _: &'static mut BitSlice<Cell<u32>, Msb0> =
bits!(static mut Cell<u32>, Msb0; 1, 0, 1, 1, 0);
let _: &'static mut BitSlice = bits!(static mut 1, 0, 1, 1, 0);
unsafe { bits!(static mut Cell<u32>, Msb0; 1, 0, 1, 1, 0) };
let _: &'static mut BitSlice = unsafe { bits!(static mut 1, 0, 1, 1, 0) };

@@ -81,0 +82,0 @@ let _: &'static BitSlice<Cell<u16>, Msb0> =

@@ -70,2 +70,3 @@ #![doc = include_str!("../doc/order.md")]

/// numerically equivalent.
#[inline]
fn select<R>(index: BitIdx<R>) -> BitSel<R>

@@ -98,2 +99,3 @@ where R: BitRegister {

/// [`BitIdx::MIN`]: crate::index::BitIdx::MIN
#[inline]
fn mask<R>(

@@ -125,2 +127,3 @@ from: impl Into<Option<BitIdx<R>>>,

unsafe impl BitOrder for Lsb0 {
#[inline]
fn at<R>(index: BitIdx<R>) -> BitPos<R>

@@ -131,2 +134,3 @@ where R: BitRegister {

#[inline]
fn select<R>(index: BitIdx<R>) -> BitSel<R>

@@ -137,2 +141,3 @@ where R: BitRegister {

#[inline]
fn mask<R>(

@@ -172,2 +177,3 @@ from: impl Into<Option<BitIdx<R>>>,

unsafe impl BitOrder for Msb0 {
#[inline]
fn at<R>(index: BitIdx<R>) -> BitPos<R>

@@ -178,2 +184,3 @@ where R: BitRegister {

#[inline]
fn select<R>(index: BitIdx<R>) -> BitSel<R>

@@ -190,2 +197,3 @@ where R: BitRegister {

#[inline]
fn mask<R>(

@@ -232,7 +240,7 @@ from: impl Into<Option<BitIdx<R>>>,

#[cfg(not(any(target_endian = "big", target_endian = "little")))]
compile_fail!(concat!(
"This architecture is currently not supported. File an issue at ",
env!(CARGO_PKG_REPOSITORY)
));
compile_fail!(
"This architecture is not supported! Please consider filing an issue"
);
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -239,0 +247,0 @@ #[doc = include_str!("../doc/order/verify.md")]

@@ -48,2 +48,3 @@ #![doc = include_str!("../doc/ptr.md")]

#[inline]
#[doc = include_str!("../doc/ptr/copy.md")]

@@ -76,2 +77,3 @@ pub unsafe fn copy<T1, T2, O1, O2>(

#[inline]
#[doc = include_str!("../doc/ptr/copy_nonoverlapping.md")]

@@ -93,2 +95,3 @@ pub unsafe fn copy_nonoverlapping<T1, T2, O1, O2>(

#[inline]
#[doc = include_str!("../doc/ptr/drop_in_place.md")]

@@ -104,2 +107,3 @@ #[deprecated = "this has no effect, and should not be called"]

#[doc = include_str!("../doc/ptr/eq.md")]
#[inline]
pub fn eq<T1, T2, O>(

@@ -117,2 +121,3 @@ this: BitPtr<Const, T1, O>,

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -129,2 +134,3 @@ #[doc = include_str!("../doc/ptr/hash.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -140,2 +146,3 @@ #[doc = include_str!("../doc/ptr/null.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -151,2 +158,3 @@ #[doc = include_str!("../doc/ptr/null_mut.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -162,2 +170,3 @@ #[doc = include_str!("../doc/ptr/read.md")]

#[inline]
#[allow(deprecated)]

@@ -175,2 +184,3 @@ #[cfg(not(tarpaulin_include))]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -186,2 +196,3 @@ #[doc = include_str!("../doc/ptr/read_volatile.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -197,2 +208,3 @@ #[doc = include_str!("../doc/ptr/replace.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -211,2 +223,3 @@ #[doc = include_str!("../doc/ptr/slice_from_raw_parts.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -225,2 +238,3 @@ #[doc = include_str!("../doc/ptr/slice_from_raw_parts_mut.md")]

#[inline]
#[doc = include_str!("../doc/ptr/swap.md")]

@@ -239,2 +253,3 @@ pub unsafe fn swap<T1, T2, O1, O2>(

#[inline]
#[doc = include_str!("../doc/ptr/swap_nonoverlapping.md")]

@@ -259,2 +274,3 @@ pub unsafe fn swap_nonoverlapping<T1, T2, O1, O2>(

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -270,2 +286,3 @@ #[doc = include_str!("../doc/ptr/write.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -285,2 +302,3 @@ #[deprecated = "use `write_bits()` instead"]

#[inline]
#[allow(deprecated)]

@@ -298,2 +316,3 @@ #[cfg(not(tarpaulin_include))]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -311,2 +330,3 @@ #[doc = include_str!("../doc/ptr/write_volatile.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -325,2 +345,3 @@ #[doc = include_str!("../doc/ptr/bitslice_from_raw_parts.md")]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -339,2 +360,3 @@ #[doc = include_str!("../doc/ptr/bitslice_from_raw_parts_mut.md")]

#[inline]
#[doc = include_str!("../doc/ptr/write_bits.md")]

@@ -341,0 +363,0 @@ pub unsafe fn write_bits<T, O>(dst: BitPtr<Mut, T, O>, value: bool, count: usize)

@@ -31,2 +31,3 @@ #![doc = include_str!("../../doc/ptr/addr.md")]

/// Ensures that an address is well-aligned to its referent type width.
#[inline]
pub fn check_alignment<M, T>(

@@ -141,2 +142,3 @@ addr: Address<M, T>,

impl<T> Debug for MisalignError<T> {
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -152,2 +154,3 @@ fmt.debug_tuple("MisalignError")

impl<T> Display for MisalignError<T> {
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -154,0 +157,0 @@ write!(

@@ -83,2 +83,3 @@ #![doc = include_str!("../../doc/ptr/proxy.md")]

/// context, and not be aliased beyond its typing indicators.
#[inline]
pub unsafe fn from_bitptr(bitptr: BitPtr<M, T, O>) -> Self {

@@ -98,2 +99,3 @@ let data = bitptr.read();

/// The syntax `&val as *T`.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -130,2 +132,3 @@ pub fn into_bitptr(self) -> BitPtr<M, T, O> {

/// [`mem::replace`](core::mem::replace)
#[inline]
pub fn replace(&mut self, src: bool) -> bool {

@@ -140,2 +143,3 @@ mem::replace(&mut self.data, src)

/// [`mem::swap`](core::mem::swap)
#[inline]
pub fn swap<T2, O2>(&mut self, other: &mut BitRef<Mut, T2, O2>)

@@ -154,2 +158,3 @@ where

/// write done in the destructor, and allows code to be slightly faster.
#[inline]
pub fn commit(self, value: bool) {

@@ -166,2 +171,3 @@ unsafe {

/// the proxy destructor runs.
#[inline]
pub fn set(&mut self, value: bool) {

@@ -178,2 +184,3 @@ self.data = value;

{
#[inline]
fn clone(&self) -> Self {

@@ -199,2 +206,3 @@ Self { ..*self }

{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {

@@ -242,2 +250,3 @@ self.data.cmp(&other.data)

{
#[inline]
fn eq(&self, other: &BitRef<'_, M, T, O>) -> bool {

@@ -268,2 +277,3 @@ other == self

{
#[inline]
fn eq(&self, other: &BitRef<'_, M, T, O>) -> bool {

@@ -285,2 +295,3 @@ other == *self

{
#[inline]
fn partial_cmp(

@@ -301,2 +312,3 @@ &self,

{
#[inline]
fn partial_cmp(&self, other: &bool) -> Option<cmp::Ordering> {

@@ -314,2 +326,3 @@ self.data.partial_cmp(other)

{
#[inline]
fn partial_cmp(&self, other: &&bool) -> Option<cmp::Ordering> {

@@ -327,2 +340,3 @@ self.data.partial_cmp(*other)

{
#[inline]
fn as_ref(&self) -> &bool {

@@ -339,2 +353,3 @@ &self.data

{
#[inline]
fn as_mut(&mut self) -> &mut bool {

@@ -351,2 +366,3 @@ &mut self.data

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -365,2 +381,3 @@ unsafe { self.bitptr.span_unchecked(1) }

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -378,2 +395,3 @@ Display::fmt(&self.data, fmt)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -391,2 +409,3 @@ Pointer::fmt(&self.bitptr, fmt)

{
#[inline]
fn hash<H>(&self, state: &mut H)

@@ -428,2 +447,3 @@ where H: Hasher {

#[inline]
fn deref(&self) -> &Self::Target {

@@ -439,2 +459,3 @@ &self.data

{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {

@@ -451,2 +472,3 @@ &mut self.data

{
#[inline]
fn drop(&mut self) {

@@ -471,2 +493,3 @@ // `Drop` cannot specialize on type parameters, but only mutable

#[inline]
fn not(self) -> Self::Output {

@@ -473,0 +496,0 @@ !self.data

@@ -76,2 +76,3 @@ #![doc = include_str!("../../doc/ptr/range.md")]

/// Explicitly converts a `Range<BitPtr>` into a `BitPtrRange`.
#[inline]
pub fn from_range(Range { start, end }: Range<BitPtr<M, T, O>>) -> Self {

@@ -82,2 +83,3 @@ Self { start, end }

/// Explicitly converts a `BitPtrRange` into a `Range<BitPtr>`.
#[inline]
pub fn into_range(self) -> Range<BitPtr<M, T, O>> {

@@ -112,2 +114,3 @@ let Self { start, end } = self;

/// ```
#[inline]
pub fn is_empty(&self) -> bool {

@@ -155,2 +158,3 @@ self.start == self.end

/// being tested is numerically within the range.
#[inline]
pub fn contains<M2, T2>(&self, pointer: &BitPtr<M2, T2, O>) -> bool

@@ -183,2 +187,3 @@ where

/// This method is only safe to call when the range is non-empty.
#[inline]
fn take_front(&mut self) -> BitPtr<M, T, O> {

@@ -195,2 +200,3 @@ let start = self.start;

/// This method is only safe to call when the range is non-empty.
#[inline]
fn take_back(&mut self) -> BitPtr<M, T, O> {

@@ -210,2 +216,3 @@ let prev = self.end.wrapping_sub(1);

{
#[inline]
fn clone(&self) -> Self {

@@ -233,2 +240,3 @@ Self { ..*self }

{
#[inline]
fn eq(&self, other: &BitPtrRange<M2, T2, O>) -> bool {

@@ -249,2 +257,3 @@ // Pointers over different element types are never equal

{
#[inline]
fn default() -> Self {

@@ -262,2 +271,3 @@ Self::EMPTY

{
#[inline]
fn from(range: Range<BitPtr<M, T, O>>) -> Self {

@@ -275,2 +285,3 @@ Self::from_range(range)

{
#[inline]
fn from(range: BitPtrRange<M, T, O>) -> Self {

@@ -288,2 +299,3 @@ range.into_range()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -304,2 +316,3 @@ let Range { start, end } = self.clone().into_range();

{
#[inline]
fn hash<H>(&self, state: &mut H)

@@ -322,2 +335,3 @@ where H: Hasher {

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -330,2 +344,3 @@ if Self::is_empty(&*self) {

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -347,2 +362,3 @@ if n >= self.len() {

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -355,2 +371,3 @@ if Self::is_empty(&*self) {

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -373,2 +390,3 @@ if n >= self.len() {

{
#[inline]
fn len(&self) -> usize {

@@ -394,2 +412,3 @@ (unsafe { self.end.offset_from(self.start) }) as usize

{
#[inline]
fn start_bound(&self) -> Bound<&BitPtr<M, T, O>> {

@@ -399,2 +418,3 @@ Bound::Included(&self.start)

#[inline]
fn end_bound(&self) -> Bound<&BitPtr<M, T, O>> {

@@ -401,0 +421,0 @@ Bound::Excluded(&self.end)

@@ -97,2 +97,3 @@ #![doc = include_str!("../../doc/ptr/single.md")]

/// access on `.ptr` through a reference except through this method.
#[inline]
fn get_addr(&self) -> Address<M, T> {

@@ -127,2 +128,3 @@ unsafe { ptr::addr_of!(self.ptr).read_unaligned() }

/// [`::from_slice_mut()`]: Self::from_slice_mut
#[inline]
pub fn new(

@@ -162,2 +164,3 @@ ptr: Address<M, T>,

/// [0]: crate::ptr::check_alignment.
#[inline]
pub unsafe fn new_unchecked(

@@ -180,2 +183,3 @@ ptr: Address<M, T>,

/// Gets the address of the base storage element.
#[inline]
pub fn address(self) -> Address<M, T> {

@@ -186,2 +190,3 @@ self.get_addr()

/// Gets the `BitIdx` that selects the bit within the memory element.
#[inline]
pub fn bit(self) -> BitIdx<T::Mem> {

@@ -202,2 +207,3 @@ self.bit

/// parameter.
#[inline]
pub fn raw_parts(self) -> (Address<M, T>, BitIdx<T::Mem>) {

@@ -265,2 +271,3 @@ (self.address(), self.bit())

/// Removes write permissions from a bit-pointer.
#[inline]
pub fn to_const(self) -> BitPtr<Const, T, O> {

@@ -284,2 +291,3 @@ let Self {

/// This pointer must have been derived from a `*mut` pointer.
#[inline]
pub unsafe fn to_mut(self) -> BitPtr<Mut, T, O> {

@@ -323,2 +331,3 @@ let Self {

/// Constructs a `BitPtr` to the zeroth bit in a single element.
#[inline]
pub fn from_ref(elem: &T) -> Self {

@@ -335,2 +344,3 @@ unsafe { Self::new_unchecked(elem.into(), BitIdx::MIN) }

/// departure from the subslice, *even within the original slice*, illegal.
#[inline]
pub fn from_slice(slice: &[T]) -> Self {

@@ -343,2 +353,3 @@ unsafe {

/// Gets a raw pointer to the memory element containing the selected bit.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -356,2 +367,3 @@ pub fn pointer(&self) -> *const T {

/// Constructs a mutable `BitPtr` to the zeroth bit in a single element.
#[inline]
pub fn from_mut(elem: &mut T) -> Self {

@@ -368,2 +380,3 @@ unsafe { Self::new_unchecked(elem.into(), BitIdx::MIN) }

/// departure from the subslice, *even within the original slice*, illegal.
#[inline]
pub fn from_mut_slice(slice: &mut [T]) -> Self {

@@ -382,2 +395,3 @@ unsafe {

/// departure from the subslice, *even within the original slice*, illegal.
#[inline]
pub fn from_slice_mut(slice: &mut [T]) -> Self {

@@ -390,2 +404,3 @@ unsafe {

/// Gets a raw pointer to the memory location containing the selected bit.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -412,2 +427,3 @@ pub fn pointer(&self) -> *mut T {

/// [`pointer::is_null`](https://doc.rust-lang.org/std/primitive.pointer.html#method.is_null)
#[inline]
#[deprecated = "`BitPtr` is never null"]

@@ -430,2 +446,3 @@ pub fn is_null(self) -> bool {

/// [`pointer::cast`](https://doc.rust-lang.org/std/primitive.pointer.html#method.cast)
#[inline]
pub fn cast<U>(self) -> BitPtr<M, U, O>

@@ -451,2 +468,3 @@ where U: BitStore {

/// [`.raw_parts()`]: Self::raw_parts
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -495,2 +513,3 @@ pub fn to_raw_parts(self) -> (Address<M, T>, BitIdx<T::Mem>) {

/// ```
#[inline]
pub unsafe fn as_ref<'a>(self) -> Option<BitRef<'a, Const, T, O>> {

@@ -543,2 +562,3 @@ Some(BitRef::from_bitptr(self.to_const()))

/// [`.wrapping_offset()`]: Self::wrapping_offset
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -603,2 +623,3 @@ pub unsafe fn offset(self, count: isize) -> Self {

/// ```
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -667,3 +688,3 @@ pub fn wrapping_offset(self, count: isize) -> Self {

/// let diff = (b_ptr.pointer() as isize)
/// .wrapping_mul(a_ptr.pointer() as isize)
/// .wrapping_sub(a_ptr.pointer() as isize)
/// // Remember: raw pointers are byte-stepped,

@@ -682,2 +703,3 @@ /// // but bit-pointers are bit-stepped.

/// [`.offset()`]: Self::offset
#[inline]
pub unsafe fn offset_from<U>(self, origin: BitPtr<M, U, O>) -> isize

@@ -705,2 +727,3 @@ where U: BitStore<Mem = T::Mem> {

/// See [`.offset()`](Self::offset).
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -723,2 +746,3 @@ pub unsafe fn add(self, count: usize) -> Self {

/// See [`.offset()`](Self::offset).
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -741,2 +765,3 @@ pub unsafe fn sub(self, count: usize) -> Self {

/// See [`.wrapping_offset()`](Self::wrapping_offset).
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -760,2 +785,3 @@ pub fn wrapping_add(self, count: usize) -> Self {

/// See [`.wrapping_offset()`](Self::wrapping_offset).
#[inline]
#[must_use = "returns a new bit-pointer rather than modifying its argument"]

@@ -775,4 +801,5 @@ pub fn wrapping_sub(self, count: usize) -> Self {

/// See [`ptr::read`](crate::ptr::read).
#[inline]
pub unsafe fn read(self) -> bool {
(&*self.ptr.to_const()).load_value().get_bit::<O>(self.bit)
(*self.ptr.to_const()).load_value().get_bit::<O>(self.bit)
}

@@ -795,2 +822,3 @@

/// [0]: https://docs.rs/voladdress/later/voladdress
#[inline]
pub unsafe fn read_volatile(self) -> bool {

@@ -814,2 +842,3 @@ self.ptr.to_const().read_volatile().get_bit::<O>(self.bit)

/// See [`ptr::read_unaligned`](crate::ptr::read_unaligned)
#[inline]
#[deprecated = "`BitPtr` does not have unaligned addresses"]

@@ -834,2 +863,3 @@ pub unsafe fn read_unaligned(self) -> bool {

/// See [`ptr::copy`](crate::ptr::copy).
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -854,2 +884,3 @@ pub unsafe fn copy_to<T2, O2>(self, dest: BitPtr<Mut, T2, O2>, count: usize)

/// See [`ptr::copy_nonoverlapping`](crate::ptr::copy_nonoverlapping).
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -924,2 +955,3 @@ pub unsafe fn copy_to_nonoverlapping<T2, O2>(

/// [`.wrapping_add()`]: Self::wrapping_add
#[inline]
pub fn align_offset(self, align: usize) -> usize {

@@ -991,2 +1023,3 @@ let width = mem::bits_of::<T::Mem>();

/// [`.commit()`]: crate::ptr::BitRef::commit
#[inline]
pub unsafe fn as_mut<'a>(self) -> Option<BitRef<'a, Mut, T, O>> {

@@ -1014,2 +1047,3 @@ Some(BitRef::from_bitptr(self))

/// [`ptr::copy`]: crate::ptr::copy
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1046,2 +1080,3 @@ pub unsafe fn copy_from<T2, O2>(

/// [`.copy_from()`]: Self::copy_from
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1072,2 +1107,3 @@ pub unsafe fn copy_from_nonoverlapping<T2, O2>(

/// [`ptr::drop_in_place`]: crate::ptr::drop_in_place
#[inline]
#[deprecated = "this has no effect, and should not be called"]

@@ -1087,2 +1123,3 @@ pub fn drop_in_place(self) {}

/// [`ptr::write`]: crate::ptr::write
#[inline]
pub unsafe fn write(self, value: bool) {

@@ -1120,2 +1157,4 @@ self.replace(value);

/// [`voladdr`]: https://docs.rs/voladdr/latest/voladdr
#[inline]
#[allow(clippy::needless_borrow)] // Clippy is wrong.
pub unsafe fn write_volatile(self, value: bool) {

@@ -1143,2 +1182,4 @@ let ptr = self.ptr.to_mut();

/// [`ptr::write_unaligned`]: crate::ptr::write_unaligned
#[inline]
#[allow(clippy::needless_borrow)] // Clippy is wrong.
#[deprecated = "`BitPtr` does not have unaligned addresses"]

@@ -1164,2 +1205,3 @@ pub unsafe fn write_unaligned(self, value: bool) {

/// [`ptr::replace`]: crate::ptr::replace
#[inline]
pub unsafe fn replace(self, value: bool) -> bool {

@@ -1180,2 +1222,3 @@ self.freeze().frozen_write_bit(value)

/// [`ptr::swap`]: crate::ptr::swap
#[inline]
pub unsafe fn swap<T2, O2>(self, with: BitPtr<Mut, T2, O2>)

@@ -1202,3 +1245,3 @@ where

pub(crate) unsafe fn frozen_write_bit(self, value: bool) -> bool {
(&*self.ptr.cast::<T::Access>().to_const())
(*self.ptr.cast::<T::Access>().to_const())
.write_bit::<O>(self.bit, value)

@@ -1215,2 +1258,3 @@ }

{
#[inline]
fn clone(&self) -> Self {

@@ -1238,2 +1282,3 @@ Self {

{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {

@@ -1273,2 +1318,3 @@ self.partial_cmp(other).expect(

{
#[inline]
fn partial_cmp(&self, other: &BitPtr<M2, T2, O>) -> Option<cmp::Ordering> {

@@ -1295,2 +1341,3 @@ if !dvl::match_store::<T1::Mem, T2::Mem>() {

{
#[inline]
fn from(elem: &T) -> Self {

@@ -1307,2 +1354,3 @@ Self::from_ref(elem)

{
#[inline]
fn from(elem: &mut T) -> Self {

@@ -1320,2 +1368,3 @@ Self::from_mut(elem)

#[inline]
fn try_from(elem: *const T) -> Result<Self, Self::Error> {

@@ -1335,2 +1384,3 @@ elem.try_conv::<Address<Const, T>>()?

#[inline]
fn try_from(elem: *mut T) -> Result<Self, Self::Error> {

@@ -1349,2 +1399,3 @@ elem.try_conv::<Address<Mut, T>>()?

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -1368,2 +1419,3 @@ write!(

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -1384,2 +1436,3 @@ fmt.debug_tuple("")

{
#[inline]
fn hash<H>(&self, state: &mut H)

@@ -1416,2 +1469,3 @@ where H: Hasher {

{
#[inline]
fn from(err: MisalignError<T>) -> Self {

@@ -1426,2 +1480,3 @@ Self::Misaligned(err)

{
#[inline]
fn from(err: NullPtrError) -> Self {

@@ -1428,0 +1483,0 @@ Self::Null(err)

@@ -480,3 +480,3 @@ #![doc = include_str!("../../doc/ptr/span.md")]

let mid_base =
this.add(step).address().cast::<U>().pipe(|addr| unsafe {
this.add(step).address().cast::<U>().pipe(|addr| {
BitPtr::<M, U, O>::new_unchecked(addr, BitIdx::MIN)

@@ -490,9 +490,5 @@ });

let right_base =
mid_base
.address()
.add(mid_elts)
.cast::<T>()
.pipe(|addr| unsafe {
BitPtr::<M, T, O>::new_unchecked(addr, BitIdx::MIN)
});
mid_base.address().add(mid_elts).cast::<T>().pipe(|addr| {
BitPtr::<M, T, O>::new_unchecked(addr, BitIdx::MIN)
});
let right = right_base.span_unchecked(excess);

@@ -694,2 +690,3 @@

{
#[inline]
fn clone(&self) -> Self {

@@ -708,2 +705,3 @@ *self

{
#[inline]
fn eq(&self, other: &BitSpan<M2, T2, O>) -> bool {

@@ -724,2 +722,3 @@ let (addr_a, head_a, bits_a) = self.raw_parts();

{
#[inline]
fn from(bits: &BitSlice<T, O>) -> Self {

@@ -735,2 +734,3 @@ Self::from_bitslice_ptr(bits)

{
#[inline]
fn from(bits: &mut BitSlice<T, O>) -> Self {

@@ -748,2 +748,3 @@ Self::from_bitslice_ptr_mut(bits)

{
#[inline]
fn default() -> Self {

@@ -760,2 +761,3 @@ Self::EMPTY

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -772,2 +774,3 @@ self.render(fmt, "Span", None)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -810,2 +813,3 @@ Pointer::fmt(&self.address(), fmt)?;

{
#[inline]
fn from(err: BitPtrError<T>) -> Self {

@@ -823,2 +827,3 @@ match err {

{
#[inline]
fn from(err: MisalignError<T>) -> Self {

@@ -833,2 +838,3 @@ Self::Misaligned(err)

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -853,2 +859,3 @@ write!(fmt, "BitSpanError<{}>::", any::type_name::<T::Mem>())?;

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -855,0 +862,0 @@ match self {

@@ -8,5 +8,13 @@ #![cfg(feature = "serde")]

/// A list of fields in the `BitSeq` and `BitArr` transport format.
static FIELDS: &[&str] = &["order", "head", "bits", "data"];
use core::fmt::{
self,
Formatter,
};
use serde::de::{
Deserialize,
Deserializer,
Visitor,
};
/// A result of serialization.

@@ -18,2 +26,46 @@ type Result<S> = core::result::Result<

/// A list of fields in the `BitSeq` and `BitArr` transport format.
static FIELDS: &[&str] = &["order", "head", "bits", "data"];
/// The components of a bit-slice in wire format.
enum Field {
/// Denotes the `<O: BitOrder>` type parameter.
Order,
/// Denotes the head-bit index in the first `Data` element.
Head,
/// Denotes the count of all live bits in the `Data` sequence.
Bits,
/// Denotes the raw storage sequence.
Data,
}
/// Visits field tokens without attempting to deserialize into real data.
struct FieldVisitor;
impl<'de> Deserialize<'de> for Field {
fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
where D: Deserializer<'de> {
deserializer.deserialize_identifier(FieldVisitor)
}
}
impl<'de> Visitor<'de> for FieldVisitor {
type Value = Field;
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {
fmt.write_str("field_identifier")
}
fn visit_str<E>(self, value: &str) -> core::result::Result<Self::Value, E>
where E: serde::de::Error {
match value {
"order" => Ok(Field::Order),
"head" => Ok(Field::Head),
"bits" => Ok(Field::Bits),
"data" => Ok(Field::Data),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
#[cfg(test)]

@@ -20,0 +72,0 @@ mod tests {

@@ -9,3 +9,2 @@ #![doc=include_str!("../../doc/serdes/array.md")]

},
marker::PhantomData,
};

@@ -31,3 +30,7 @@

use super::{
utils::Array,
utils::{
Array,
TypeName,
},
Field,
FIELDS,

@@ -49,2 +52,3 @@ };

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -72,2 +76,3 @@ where S: Serializer {

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -92,10 +97,7 @@ where S: Serializer {

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de> {
deserializer
.deserialize_struct(
"BitArr",
FIELDS,
BitArrVisitor::<'de, T, O, 1>::THIS,
)
.deserialize_struct("BitArr", FIELDS, BitArrVisitor::<T, O, 1>::THIS)
.map(|BitArray { data: [elem], .. }| BitArray::new(elem))

@@ -111,2 +113,3 @@ }

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -117,3 +120,3 @@ where D: Deserializer<'de> {

FIELDS,
BitArrVisitor::<'de, T, O, N>::THIS,
BitArrVisitor::<T, O, N>::THIS,
)

@@ -124,12 +127,9 @@ }

/// Assists in deserialization of a static `BitArr`.
struct BitArrVisitor<'de, T, O, const N: usize>
struct BitArrVisitor<T, O, const N: usize>
where
T: BitStore,
O: BitOrder,
Array<T, N>: Deserialize<'de>,
{
/// This produces a bit-array value during its work.
typ: PhantomData<BitArray<T, O>>,
/// The deserialized bit-ordering string.
order: Option<&'de str>,
order: Option<TypeName<O>>,
/// The deserialized head-bit index. This must be zero; it is used for

@@ -144,3 +144,3 @@ /// consistency with `BitSeq` and to carry `T::Mem` information.

impl<'de, T, O, const N: usize> BitArrVisitor<'de, T, O, N>
impl<'de, T, O, const N: usize> BitArrVisitor<T, O, N>
where

@@ -153,3 +153,2 @@ T: BitStore,

const THIS: Self = Self {
typ: PhantomData,
order: None,

@@ -162,6 +161,6 @@ head: None,

/// Attempts to assemble deserialized components into an output value.
#[inline]
fn assemble<E>(mut self) -> Result<BitArray<[T; N], O>, E>
where E: Error {
let order =
self.order.take().ok_or_else(|| E::missing_field("order"))?;
self.order.take().ok_or_else(|| E::missing_field("order"))?;
let head = self.head.take().ok_or_else(|| E::missing_field("head"))?;

@@ -171,5 +170,2 @@ let bits = self.bits.take().ok_or_else(|| E::missing_field("bits"))?;

if order != any::type_name::<O>() {
return Err(E::invalid_type(Unexpected::Str(order), &self));
}
if head != BitIdx::MIN {

@@ -190,3 +186,3 @@ return Err(E::invalid_value(

impl<'de, T, O, const N: usize> Visitor<'de> for BitArrVisitor<'de, T, O, N>
impl<'de, T, O, const N: usize> Visitor<'de> for BitArrVisitor<T, O, N>
where

@@ -199,2 +195,3 @@ T: BitStore,

#[inline]
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -210,2 +207,3 @@ write!(

#[inline]
fn visit_seq<V>(mut self, mut seq: V) -> Result<Self::Value, V::Error>

@@ -233,7 +231,8 @@ where V: SeqAccess<'de> {

#[inline]
fn visit_map<V>(mut self, mut map: V) -> Result<Self::Value, V::Error>
where V: MapAccess<'de> {
while let Some(key) = map.next_key::<&'de str>()? {
while let Some(key) = map.next_key()? {
match key {
"order" => {
Field::Order => {
if self.order.replace(map.next_value()?).is_some() {

@@ -243,3 +242,3 @@ return Err(<V::Error>::duplicate_field("order"));

},
"head" => {
Field::Head => {
if self.head.replace(map.next_value()?).is_some() {

@@ -249,3 +248,3 @@ return Err(<V::Error>::duplicate_field("head"));

},
"bits" => {
Field::Bits => {
if self.bits.replace(map.next_value()?).is_some() {

@@ -255,3 +254,3 @@ return Err(<V::Error>::duplicate_field("bits"));

},
"data" => {
Field::Data => {
if self.data.replace(map.next_value()?).is_some() {

@@ -261,6 +260,2 @@ return Err(<V::Error>::duplicate_field("data"));

},
f => {
let _ = map.next_value::<()>();
return Err(<V::Error>::unknown_field(f, FIELDS));
},
}

@@ -302,2 +297,6 @@ }

let json_value = serde_json::to_value(&array)?;
let array4 = serde_json::from_value::<BA>(json_value)?;
assert_eq!(array, array4);
type BA2 = BitArray<u16, Msb0>;

@@ -314,2 +313,6 @@ let array = BA2::new(44203);

let json_value = serde_json::to_value(&array)?;
let array4 = serde_json::from_value::<BA2>(json_value)?;
assert_eq!(array, array4);
Ok(())

@@ -366,5 +369,17 @@ }

type BA = BitArr!(for 8, in u8, Msb0);
let tokens = &mut [
let mut tokens = vec![
Token::Seq { len: Some(4) },
Token::BorrowedStr(any::type_name::<Msb0>()),
];
assert_de_tokens_error::<BitArr!(for 8, in u8, Lsb0)>(
&tokens,
&format!(
"invalid value: string \"{}\", expected the string \"{}\"",
any::type_name::<Msb0>(),
any::type_name::<Lsb0>(),
),
);
tokens.extend([
Token::Seq { len: Some(2) },

@@ -379,13 +394,7 @@ Token::U8(8),

Token::SeqEnd,
];
]);
assert_de_tokens_error::<BitArr!(for 8, in u8, Lsb0)>(
tokens,
"invalid type: string \"bitvec::order::Msb0\", expected a \
`BitArray<[u8; 1], bitvec::order::Lsb0>`",
);
tokens[6] = Token::U64(7);
assert_de_tokens_error::<BA>(
tokens,
&tokens,
"invalid length 7, expected a `BitArray<[u8; 1], \

@@ -397,3 +406,3 @@ bitvec::order::Msb0>`",

assert_de_tokens_error::<BA>(
tokens,
&tokens,
"invalid value: integer `1`, expected `BitArray` must have a \

@@ -410,4 +419,2 @@ head-bit of `0`",

Token::BorrowedStr("placeholder"),
Token::Unit,
Token::StructEnd,
],

@@ -414,0 +421,0 @@ &format!(

@@ -21,3 +21,2 @@ #![doc=include_str!("../../doc/serdes/slice.md")]

SeqAccess,
Unexpected,
Visitor,

@@ -33,3 +32,7 @@ },

use super::FIELDS;
use super::{
utils::TypeName,
Field,
FIELDS,
};
#[cfg(feature = "alloc")]

@@ -59,2 +62,3 @@ use crate::{

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -81,2 +85,3 @@ where S: Serializer {

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -95,2 +100,3 @@ where S: Serializer {

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -105,2 +111,3 @@ where S: Serializer {

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -111,3 +118,3 @@ where D: Deserializer<'de> {

FIELDS,
BitSeqVisitor::<'de, u8, O, &'de [u8], Self, _>::new(
BitSeqVisitor::<u8, O, &'de [u8], Self, _>::new(
|data, head, bits| unsafe {

@@ -129,2 +136,3 @@ BitSpan::new(data.as_ptr().into_address(), head, bits)

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -144,2 +152,3 @@ where D: Deserializer<'de> {

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -150,3 +159,3 @@ where D: Deserializer<'de> {

FIELDS,
BitSeqVisitor::<'de, T, O, Vec<T>, Self, _>::new(
BitSeqVisitor::<T, O, Vec<T>, Self, _>::new(
|vec, head, bits| unsafe {

@@ -168,15 +177,12 @@ let addr = vec.as_ptr().into_address();

/// Assists in deserialization of a dynamic `BitSeq`.
struct BitSeqVisitor<'de, T, O, In, Out, Func>
struct BitSeqVisitor<T, O, In, Out, Func>
where
T: 'de + BitStore,
T: BitStore,
O: BitOrder,
In: Deserialize<'de>,
Func: FnOnce(In, BitIdx<T::Mem>, usize) -> Result<Out, BitSpanError<T>>,
{
/// This produces a bit-slice reference during its work,
typ: PhantomData<&'de BitSlice<T, O>>,
/// As well as a final output value.
out: PhantomData<Result<Out, BitSpanError<T>>>,
/// The deserialized bit-ordering string.
order: Option<&'de str>,
order: Option<TypeName<O>>,
/// The deserialized head-bit index.

@@ -193,3 +199,3 @@ head: Option<BitIdx<T::Mem>>,

impl<'de, T, O, In, Out, Func> BitSeqVisitor<'de, T, O, In, Out, Func>
impl<'de, T, O, In, Out, Func> BitSeqVisitor<T, O, In, Out, Func>
where

@@ -202,5 +208,5 @@ T: 'de + BitStore,

/// Creates a new visitor with a given transform functor.
#[inline]
fn new(func: Func) -> Self {
Self {
typ: PhantomData,
out: PhantomData,

@@ -216,6 +222,6 @@ order: None,

/// Attempts to assemble deserialized components into an output value.
#[inline]
fn assemble<E>(mut self) -> Result<Out, E>
where E: Error {
let order =
self.order.take().ok_or_else(|| E::missing_field("order"))?;
self.order.take().ok_or_else(|| E::missing_field("order"))?;
let head = self.head.take().ok_or_else(|| E::missing_field("head"))?;

@@ -225,5 +231,2 @@ let bits = self.bits.take().ok_or_else(|| E::missing_field("bits"))?;

if order != any::type_name::<O>() {
return Err(E::invalid_type(Unexpected::Str(order), &self));
}
(self.func)(data, head, bits as usize).map_err(|_| todo!())

@@ -234,3 +237,3 @@ }

impl<'de, T, O, In, Out, Func> Visitor<'de>
for BitSeqVisitor<'de, T, O, In, Out, Func>
for BitSeqVisitor<T, O, In, Out, Func>
where

@@ -244,2 +247,3 @@ T: 'de + BitStore,

#[inline]
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -254,2 +258,3 @@ write!(

#[inline]
fn visit_seq<V>(mut self, mut seq: V) -> Result<Self::Value, V::Error>

@@ -277,7 +282,8 @@ where V: SeqAccess<'de> {

#[inline]
fn visit_map<V>(mut self, mut map: V) -> Result<Self::Value, V::Error>
where V: MapAccess<'de> {
while let Some(key) = map.next_key::<&'de str>()? {
while let Some(key) = map.next_key()? {
match key {
"order" => {
Field::Order => {
if self.order.replace(map.next_value()?).is_some() {

@@ -287,3 +293,3 @@ return Err(<V::Error>::duplicate_field("order"));

},
"head" => {
Field::Head => {
if self.head.replace(map.next_value()?).is_some() {

@@ -293,3 +299,3 @@ return Err(<V::Error>::duplicate_field("head"));

},
"bits" => {
Field::Bits => {
if self.bits.replace(map.next_value()?).is_some() {

@@ -299,3 +305,3 @@ return Err(<V::Error>::duplicate_field("bits"));

},
"data" => {
Field::Data => {
if self.data.replace(map.next_value()?).is_some() {

@@ -305,6 +311,2 @@ return Err(<V::Error>::duplicate_field("data"));

},
f => {
let _ = map.next_value::<()>();
return Err(<V::Error>::unknown_field(f, FIELDS));
},
}

@@ -396,12 +398,5 @@ }

Token::BorrowedStr(any::type_name::<Lsb0>()),
Token::Seq { len: Some(2) },
Token::U8(8),
Token::U8(1),
Token::SeqEnd,
Token::U64(9),
Token::BorrowedBytes(&[0x3C, 0xA5]),
Token::SeqEnd,
],
&format!(
"invalid type: string \"{}\", expected a `BitSlice<u8, {}>`",
"invalid value: string \"{}\", expected the string \"{}\"",
any::type_name::<Lsb0>(),

@@ -419,4 +414,2 @@ any::type_name::<Msb0>(),

Token::BorrowedStr("unknown"),
Token::BorrowedStr("field"),
Token::StructEnd,
],

@@ -423,0 +416,0 @@ &format!(

@@ -45,8 +45,83 @@ #![doc=include_str!("../../doc/serdes/utils.md")]

/// A zero-sized type that deserializes from any string as long as it is equal
/// to `any::type_name::<T>()`.
pub(super) struct TypeName<T>(PhantomData<T>);
impl<T> TypeName<T> {
/// Creates a type-name ghost for any type.
fn new() -> Self {
TypeName(PhantomData)
}
}
impl<'de, T> Deserialize<'de> for TypeName<T> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de> {
deserializer.deserialize_str(Self::new())
}
}
impl<'de, T> Visitor<'de> for TypeName<T> {
type Value = Self;
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "the string {:?}", any::type_name::<T>())
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
where E: serde::de::Error {
if value == any::type_name::<T>() {
Ok(self)
}
else {
Err(serde::de::Error::invalid_value(
Unexpected::Str(value),
&self,
))
}
}
}
/// Fields used in the `BitIdx` transport format.
static FIELDS: &[&str] = &["width", "index"];
/// The components of a bit-idx in wire format.
enum Field {
/// Denotes the maximum allowable value of the bit-idx.
Width,
/// Denotes the value of the bit-idx.
Index,
}
/// Visits field tokens of a bit-idx wire format.
struct FieldVisitor;
impl<'de> Deserialize<'de> for Field {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de> {
deserializer.deserialize_identifier(FieldVisitor)
}
}
impl<'de> Visitor<'de> for FieldVisitor {
type Value = Field;
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {
fmt.write_str("field identifier")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
where E: serde::de::Error {
match value {
"width" => Ok(Field::Width),
"index" => Ok(Field::Index),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
impl<R> Serialize for BitIdx<R>
where R: BitRegister
{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -68,2 +143,3 @@ where S: Serializer {

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -85,2 +161,3 @@ where D: Deserializer<'de> {

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -128,2 +205,3 @@ where S: Serializer {

{
#[inline]
fn serialize<S>(&self, serializer: S) -> super::Result<S>

@@ -146,2 +224,3 @@ where S: Serializer {

{
#[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>

@@ -175,2 +254,3 @@ where D: Deserializer<'de> {

#[inline]
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -180,2 +260,3 @@ write!(fmt, "a [{}; {}]", any::type_name::<T>(), N)

#[inline]
fn visit_seq<V>(self, mut seq: V) -> Result<Self::Value, V::Error>

@@ -213,2 +294,3 @@ where V: SeqAccess<'de> {

/// Attempts to assemble deserialized components into an output value.
#[inline]
fn assemble<E>(self, width: u8, index: u8) -> Result<BitIdx<R>, E>

@@ -236,2 +318,3 @@ where E: Error {

#[inline]
fn expecting(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -241,2 +324,3 @@ write!(fmt, "a valid `BitIdx<u{}>`", bits_of::<R>())

#[inline]
fn visit_seq<V>(self, mut seq: V) -> Result<Self::Value, V::Error>

@@ -254,2 +338,3 @@ where V: SeqAccess<'de> {

#[inline]
fn visit_map<V>(self, mut map: V) -> Result<Self::Value, V::Error>

@@ -260,5 +345,5 @@ where V: MapAccess<'de> {

while let Some(key) = map.next_key::<&'de str>()? {
while let Some(key) = map.next_key()? {
match key {
"width" => {
Field::Width => {
if width.replace(map.next_value::<u8>()?).is_some() {

@@ -268,3 +353,3 @@ return Err(<V::Error>::duplicate_field("width"));

},
"index" => {
Field::Index => {
if index.replace(map.next_value::<u8>()?).is_some() {

@@ -274,6 +359,2 @@ return Err(<V::Error>::duplicate_field("index"));

},
f => {
let _ = map.next_value::<()>();
return Err(<V::Error>::unknown_field(f, FIELDS));
},
}

@@ -379,4 +460,2 @@ }

Token::BorrowedStr("unknown"),
Token::BorrowedStr("field"),
Token::StructEnd,
],

@@ -383,0 +462,0 @@ "unknown field `unknown`, expected `width` or `index`",

@@ -108,2 +108,3 @@ #![doc = include_str!("../doc/slice.md")]

/// ```
#[inline]
pub fn empty<'a>() -> &'a Self {

@@ -127,2 +128,3 @@ unsafe { BitSpan::<Const, T, O>::EMPTY.into_bitslice_ref() }

/// ```
#[inline]
pub fn empty_mut<'a>() -> &'a mut Self {

@@ -161,2 +163,3 @@ unsafe { BitSpan::<Mut, T, O>::EMPTY.into_bitslice_mut() }

/// [`.view_bits::<O>()`]: crate::view::BitView::view_bits
#[inline]
pub fn from_element(elem: &T) -> &Self {

@@ -204,2 +207,3 @@ unsafe {

/// [`.view_bits_mut::<O>()`]: crate::view::BitView::view_bits_mut
#[inline]
pub fn from_element_mut(elem: &mut T) -> &mut Self {

@@ -245,2 +249,3 @@ unsafe {

/// [`.view_bits::<O>()`]: crate::view::BitView::view_bits
#[inline]
pub fn from_slice(slice: &[T]) -> &Self {

@@ -285,2 +290,3 @@ Self::try_from_slice(slice).unwrap()

/// [`.try_view_bits::<O>()`]: crate::view::BitView::try_view_bits
#[inline]
pub fn try_from_slice(slice: &[T]) -> Result<&Self, BitSpanError<T>> {

@@ -333,2 +339,3 @@ let elts = slice.len();

/// [`.view_bits_mut::<O>()`]: crate::view::BitView::view_bits_mut
#[inline]
pub fn from_slice_mut(slice: &mut [T]) -> &mut Self {

@@ -372,2 +379,3 @@ Self::try_from_slice_mut(slice).unwrap()

/// [`.try_view_bits_mut::<O>()`]: crate::view::BitView::try_view_bits_mut
#[inline]
pub fn try_from_slice_mut(

@@ -401,2 +409,3 @@ slice: &mut [T],

/// compiler UB.
#[inline]
pub unsafe fn from_slice_unchecked(slice: &[T]) -> &Self {

@@ -423,2 +432,3 @@ let bits = slice.len().wrapping_mul(mem::bits_of::<T::Mem>());

/// compiler UB.
#[inline]
pub unsafe fn from_slice_unchecked_mut(slice: &mut [T]) -> &mut Self {

@@ -448,2 +458,3 @@ let bits = slice.len().wrapping_mul(mem::bits_of::<T::Mem>());

/// structure, not a raw pointer.
#[inline]
pub fn as_bitptr(&self) -> BitPtr<Const, T, O> {

@@ -463,2 +474,3 @@ self.as_bitspan().to_bitptr()

/// structure, not a raw pointer.
#[inline]
pub fn as_mut_bitptr(&mut self) -> BitPtr<Mut, T, O> {

@@ -487,2 +499,3 @@ self.as_mut_bitspan().to_bitptr()

/// [`.as_ptr_range()`]: Self::as_ptr_range
#[inline]
pub fn as_bitptr_range(&self) -> BitPtrRange<Const, T, O> {

@@ -509,2 +522,3 @@ self.as_bitspan().to_bitptr_range()

/// `Range<*mut T>` and `Range<BitPtr>` do not.
#[inline]
pub fn as_mut_bitptr_range(&mut self) -> BitPtrRange<Mut, T, O> {

@@ -551,2 +565,3 @@ self.as_mut_bitspan().to_bitptr_range()

/// [`.copy_from_bitslice()`]: Self::copy_from_bitslice
#[inline]
pub fn clone_from_bitslice<T2, O2>(&mut self, src: &BitSlice<T2, O2>)

@@ -596,2 +611,3 @@ where

/// ```
#[inline]
pub fn copy_from_bitslice(&mut self, src: &Self) {

@@ -690,2 +706,3 @@ assert_eq!(

/// ```
#[inline]
pub fn swap_with_bitslice<T2, O2>(&mut self, other: &mut BitSlice<T2, O2>)

@@ -752,2 +769,3 @@ where

/// ```
#[inline]
pub fn set(&mut self, index: usize, value: bool) {

@@ -786,2 +804,3 @@ self.replace(index, value);

/// ```
#[inline]
pub unsafe fn set_unchecked(&mut self, index: usize, value: bool) {

@@ -806,2 +825,3 @@ self.replace_unchecked(index, value);

/// ```
#[inline]
pub fn replace(&mut self, index: usize, value: bool) -> bool {

@@ -832,2 +852,3 @@ self.assert_in_bounds(index, 0 .. self.len());

/// ```
#[inline]
pub unsafe fn replace_unchecked(

@@ -855,2 +876,3 @@ &mut self,

/// [`.swap()`]: Self::swap
#[inline]
pub unsafe fn swap_unchecked(&mut self, a: usize, b: usize) {

@@ -876,2 +898,3 @@ let a = self.as_mut_bitptr().add(a);

/// [`.split_at()`]: Self::split_at
#[inline]
pub unsafe fn split_at_unchecked(&self, mid: usize) -> (&Self, &Self) {

@@ -902,2 +925,3 @@ let len = self.len();

/// [`.split_at_mut()`]: Self::split_at_mut
#[inline]
pub unsafe fn split_at_unchecked_mut(

@@ -949,2 +973,3 @@ &mut self,

/// ```
#[inline]
pub unsafe fn copy_within_unchecked<R>(&mut self, src: R, dest: usize)

@@ -972,2 +997,3 @@ where R: RangeExt<usize> {

#[inline]
#[doc(hidden)]

@@ -997,2 +1023,3 @@ #[cfg(not(tarpaulin_include))]

/// included in the unaliased bit-slice.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1010,2 +1037,3 @@ pub fn bit_domain(&self) -> BitDomain<Const, T, O> {

/// able to be included in the unaliased bit-slice.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1023,2 +1051,3 @@ pub fn bit_domain_mut(&mut self) -> BitDomain<Mut, T, O> {

/// either the front or back edge of the slice are returned separately.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1036,2 +1065,3 @@ pub fn domain(&self) -> Domain<Const, T, O> {

/// elements on the front or back edge of the slice are returned separately.
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1061,2 +1091,3 @@ pub fn domain_mut(&mut self) -> Domain<Mut, T, O> {

/// ```
#[inline]
pub fn count_ones(&self) -> usize {

@@ -1089,2 +1120,3 @@ match self.domain() {

/// ```
#[inline]
pub fn count_zeros(&self) -> usize {

@@ -1145,2 +1177,3 @@ match self.domain() {

/// ```
#[inline]
pub fn iter_ones(&self) -> IterOnes<T, O> {

@@ -1184,2 +1217,3 @@ IterOnes::new(self)

/// ```
#[inline]
pub fn iter_zeros(&self) -> IterZeros<T, O> {

@@ -1202,2 +1236,3 @@ IterZeros::new(self)

/// ```
#[inline]
pub fn first_one(&self) -> Option<usize> {

@@ -1220,2 +1255,3 @@ self.iter_ones().next()

/// ```
#[inline]
pub fn first_zero(&self) -> Option<usize> {

@@ -1238,2 +1274,3 @@ self.iter_zeros().next()

/// ```
#[inline]
pub fn last_one(&self) -> Option<usize> {

@@ -1256,2 +1293,3 @@ self.iter_ones().next_back()

/// ```
#[inline]
pub fn last_zero(&self) -> Option<usize> {

@@ -1275,2 +1313,3 @@ self.iter_zeros().next_back()

/// ```
#[inline]
pub fn leading_ones(&self) -> usize {

@@ -1294,2 +1333,3 @@ self.first_zero().unwrap_or_else(|| self.len())

/// ```
#[inline]
pub fn leading_zeros(&self) -> usize {

@@ -1313,2 +1353,3 @@ self.first_one().unwrap_or_else(|| self.len())

/// ```
#[inline]
pub fn trailing_ones(&self) -> usize {

@@ -1333,2 +1374,3 @@ let len = self.len();

/// ```
#[inline]
pub fn trailing_zeros(&self) -> usize {

@@ -1352,2 +1394,3 @@ let len = self.len();

/// ```
#[inline]
pub fn any(&self) -> bool {

@@ -1370,2 +1413,3 @@ self.count_ones() > 0

/// ```
#[inline]
pub fn all(&self) -> bool {

@@ -1388,2 +1432,3 @@ self.count_zeros() == 0

/// ```
#[inline]
pub fn not_any(&self) -> bool {

@@ -1406,2 +1451,3 @@ self.count_ones() == 0

/// ```
#[inline]
pub fn not_all(&self) -> bool {

@@ -1426,2 +1472,3 @@ self.count_zeros() > 0

/// ```
#[inline]
pub fn some(&self) -> bool {

@@ -1438,11 +1485,18 @@ self.any() && self.not_all()

{
/// Shifts the contents of a bit-slice down (towards the zero-index),
/// clearing the top bits to `0`.
/// Shifts the contents of a bit-slice “left” (towards the zero-index),
/// clearing the “right” bits to `0`.
///
/// This is a more-expensive version of taking `&bits[by ..]`; unless you
/// want to directly affect the memory representation, you should use that
/// instead.
/// This is a strictly-worse analogue to taking `bits = &bits[by ..]`: it
/// has to modify the entire memory region that `bits` governs, and destroys
/// contained information. Unless the actual memory layout and contents of
/// your bit-slice matters to your program, you should *probably* prefer to
/// munch your way forward through a bit-slice handle.
///
/// Has no effect when `by` is `0`.
/// Note also that the “left” here is semantic only, and **does not**
/// necessarily correspond to a left-shift instruction applied to the
/// underlying integer storage.
///
/// This has no effect when `by` is `0`. When `by` is `self.len()`, the
/// bit-slice is entirely cleared to `0`.
///
/// ## Panics

@@ -1458,5 +1512,12 @@ ///

/// let bits = bits![mut 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1];
/// // these bits are retained ^--------------------------^
/// bits.shift_left(2);
/// assert_eq!(bits, bits![1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0]);
/// // and move here ^--------------------------^
///
/// let bits = bits![mut 1; 2];
/// bits.shift_left(2);
/// assert_eq!(bits, bits![0; 2]);
/// ```
#[inline]
pub fn shift_left(&mut self, by: usize) {

@@ -1468,5 +1529,8 @@ if by == 0 {

let len = self.len();
if by == len {
return self.fill(false);
}
assert!(
by < len,
"cannot shift a bit-slice by more than its length: {} > {}",
by <= len,
"shift must be less than the length of the bit-slice: {} >= {}",
by,

@@ -1482,11 +1546,18 @@ len,

/// Shifts the contents of a bit-slice up (away from the zero-index),
/// clearing the bottom bits to `0`.
/// Shifts the contents of a bit-slice “right” (away from the zero-index),
/// clearing the “left” bits to `0`.
///
/// This is a more-expensive version of taking `&bits[.. bits.len() - by]`;
/// unless you want to directly affect the memory representation, you should
/// just use that instead.
/// This is a strictly-worse analogue to taking `bits = &bits[.. bits.len()
/// - by]`: it must modify the entire memory region that `bits` governs, and
/// destroys contained information. Unless the actual memory layout and
/// contents of your bit-slice matters to your program, you should
/// *probably* prefer to munch your way backward through a bit-slice handle.
///
/// Has no effect when `by` is `0`.
/// Note also that the “right” here is semantic only, and **does not**
/// necessarily correspond to a right-shift instruction applied to the
/// underlying integer storage.
///
/// This has no effect when `by` is `0`. When `by` is `self.len()`, the
/// bit-slice is entirely cleared to `0`.
///
/// ## Panics

@@ -1502,5 +1573,12 @@ ///

/// let bits = bits![mut 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1];
/// // these bits stay ^--------------------------^
/// bits.shift_right(2);
/// assert_eq!(bits, bits![0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1]);
/// // and move here ^--------------------------^
///
/// let bits = bits![mut 1; 2];
/// bits.shift_right(2);
/// assert_eq!(bits, bits![0; 2]);
/// ```
#[inline]
pub fn shift_right(&mut self, by: usize) {

@@ -1512,5 +1590,8 @@ if by == 0 {

let len = self.len();
if by == len {
return self.fill(false);
}
assert!(
by < len,
"cannot shift a bit-slice by more than its length: {} > {}",
by <= len,
"shift must be less than the length of the bit-slice: {} >= {}",
by,

@@ -1645,2 +1726,3 @@ len,

/// [`.set()`]: Self::set
#[inline]
pub fn set_aliased(&self, index: usize, value: bool) {

@@ -1686,2 +1768,3 @@ self.assert_in_bounds(index, 0 .. self.len());

/// [`.set_unchecked()`]: Self::set_unchecked
#[inline]
pub unsafe fn set_aliased_unchecked(&self, index: usize, value: bool) {

@@ -1754,2 +1837,3 @@ self.as_bitptr().add(index).freeze().frozen_write_bit(value);

/// ```
#[inline]
pub fn to_bitvec(&self) -> BitVec<T::Unalias, O> {

@@ -1767,2 +1851,3 @@ self.domain()

#[inline]
#[doc = include_str!("../doc/slice/from_raw_parts_unchecked.md")]

@@ -1780,2 +1865,3 @@ pub unsafe fn from_raw_parts_unchecked<'a, T, O>(

#[inline]
#[doc = include_str!("../doc/slice/from_raw_parts_unchecked_mut.md")]

@@ -1782,0 +1868,0 @@ pub unsafe fn from_raw_parts_unchecked_mut<'a, T, O>(

@@ -10,3 +10,6 @@ #![doc = include_str!("../../doc/slice/iter.md")]

},
iter::FusedIterator,
iter::{
FusedIterator,
Map,
},
marker::PhantomData,

@@ -48,2 +51,3 @@ mem,

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -64,2 +68,3 @@ Iter::new(self)

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -122,2 +127,3 @@ IterMut::new(self)

/// ```
#[inline]
#[allow(missing_docs, clippy::missing_docs_in_private_items)]

@@ -128,2 +134,3 @@ pub fn as_bitslice(&self) -> &'a BitSlice<T, O> {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -157,9 +164,4 @@ #[deprecated = "use `.as_bitslice()` instead"]

/// [0]: crate::ptr::BitRef
pub fn by_refs(
self,
) -> impl 'a
+ Iterator<Item = &'a bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
#[inline]
pub fn by_refs(self) -> BitRefIter<'a, T, O> {
self.by_vals().map(|bit| match bit {

@@ -204,10 +206,8 @@ true => &true,

/// [0]: crate::ptr::BitRef
pub fn by_vals(
self,
) -> impl 'a
+ Iterator<Item = bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
self.range.map(|bp| unsafe { bp.read() })
#[inline]
pub fn by_vals(self) -> BitValIter<'a, T, O> {
BitValIter {
range: self.range,
_life: PhantomData,
}
}

@@ -227,12 +227,7 @@

/// [0]: crate::ptr::BitRef
#[inline]
#[cfg(not(tarpaulin_include))]
#[deprecated = "`Iterator::copied` does not exist on this type. Use \
`.by_vals()` instead"]
pub fn copied(
self,
) -> impl 'a
+ Iterator<Item = bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
pub fn copied(self) -> BitValIter<'a, T, O> {
self.by_vals()

@@ -249,2 +244,3 @@ }

{
#[inline]
fn clone(&self) -> Self {

@@ -265,2 +261,3 @@ Self {

{
#[inline]
fn as_ref(&self) -> &BitSlice<T, O> {

@@ -278,2 +275,3 @@ self.as_bitslice()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -337,2 +335,3 @@ fmt.debug_tuple("Iter").field(&self.as_bitslice()).finish()

/// ```
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -343,2 +342,3 @@ pub fn into_bitslice(self) -> &'a mut BitSlice<T::Alias, O> {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -377,2 +377,3 @@ #[deprecated = "use `.into_bitslice()` instead"]

/// ```
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -383,2 +384,3 @@ pub fn as_bitslice(&self) -> &BitSlice<T::Alias, O> {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -399,2 +401,3 @@ #[deprecated = "use `.as_bitslice()` instead"]

{
#[inline]
fn as_ref(&self) -> &BitSlice<T::Alias, O> {

@@ -412,2 +415,3 @@ self.as_bitslice()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -432,2 +436,3 @@ fmt.debug_tuple("IterMut")

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -437,2 +442,3 @@ self.range.next().map(|bp| unsafe { BitRef::from_bitptr(bp) })

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -452,2 +458,3 @@ self.range.nth(n).map(|bp| unsafe { BitRef::from_bitptr(bp) })

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -459,2 +466,3 @@ self.range

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -474,2 +482,3 @@ self.range

{
#[inline]
fn len(&self) -> usize {

@@ -535,4 +544,6 @@ self.range.len()

#[inline]
$next
#[inline]
$nth

@@ -548,4 +559,6 @@

{
#[inline]
$next_back
#[inline]
$nth_back

@@ -559,2 +572,3 @@ }

{
#[inline]
$len

@@ -572,2 +586,39 @@ }

/// An iterator over `BitSlice` that yields `&bool` directly.
pub type BitRefIter<'a, T, O> = Map<BitValIter<'a, T, O>, fn(bool) -> &'a bool>;
/// An iterator over `BitSlice` that yields `bool` directly.
pub struct BitValIter<'a, T, O>
where
T: 'a + BitStore,
O: BitOrder,
{
/// The start and end bit-pointers in the iteration region.
range: BitPtrRange<Const, T, O>,
/// Hold the lifetime of the source region, so that this does not cause UAF.
_life: PhantomData<&'a BitSlice<T, O>>,
}
group!(BitValIter => bool {
fn next(&mut self) -> Option<Self::Item> {
self.range.next().map(|bp| unsafe { bp.read() })
}
fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.range.nth(n).map(|bp| unsafe { bp.read() })
}
fn next_back(&mut self) -> Option<Self::Item> {
self.range.next_back().map(|bp| unsafe { bp.read() })
}
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
self.range.nth_back(n).map(|bp| unsafe { bp.read() })
}
fn len(&self) -> usize {
self.range.len()
}
});
#[derive(Clone, Debug)]

@@ -858,2 +909,3 @@ #[doc = include_str!("../../doc/slice/iter/Windows.md")]

/// [`ChunksExact::remainder`](core::slice::ChunksExact::remainder)
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -963,2 +1015,3 @@ pub fn remainder(&self) -> &'a BitSlice<T, O> {

/// [0]: core::slice::ChunksExactMut::into_remainder
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -985,2 +1038,3 @@ pub fn into_remainder(self) -> &'a mut BitSlice<T::Alias, O> {

/// ```
#[inline]
pub fn take_remainder(&mut self) -> &'a mut BitSlice<T::Alias, O> {

@@ -1269,2 +1323,3 @@ mem::take(&mut self.extra)

/// [`RChunksExact::remainder`](core::slice::RChunksExact::remainder)
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1374,2 +1429,3 @@ pub fn remainder(&self) -> &'a BitSlice<T, O> {

/// [0]: core::slice::RChunksExactMut::into_remainder
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -1396,2 +1452,3 @@ pub fn into_remainder(self) -> &'a mut BitSlice<T::Alias, O> {

/// ```
#[inline]
pub fn take_remainder(&mut self) -> &'a mut BitSlice<T::Alias, O> {

@@ -1471,2 +1528,3 @@ mem::take(&mut self.extra)

{
#[inline]
#[allow(missing_docs, clippy::missing_docs_in_private_items)]

@@ -1521,2 +1579,3 @@ pub(super) fn new(

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -1538,4 +1597,6 @@ fmt.debug_struct(stringify!($iter))

#[inline]
$next
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {

@@ -1557,2 +1618,3 @@ if self.done {

{
#[inline]
$next_back

@@ -1575,2 +1637,3 @@ }

{
#[inline]
fn finish(&mut self) -> Option<Self::Item> {

@@ -1837,3 +1900,3 @@ if self.done {

};
self.slice = rest;
self.slice = rest;
Some(out)

@@ -2002,2 +2065,3 @@ }

{
#[inline]
#[allow(missing_docs, clippy::missing_docs_in_private_items)]

@@ -2040,2 +2104,3 @@ pub(super) fn new(

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -2055,2 +2120,3 @@ match self.count {

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {

@@ -2099,2 +2165,3 @@ let (low, hi) = self.inner.size_hint();

{
#[inline]
#[allow(missing_docs, clippy::missing_docs_in_private_items)]

@@ -2114,2 +2181,3 @@ pub(super) fn new(slice: &'a BitSlice<T, O>) -> Self {

{
#[inline]
fn default() -> Self {

@@ -2132,2 +2200,3 @@ Self {

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -2168,2 +2237,3 @@ let pos = if let Some(bits) = self.inner.coerce::<T, Lsb0>() {

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -2199,2 +2269,3 @@ let pos = if let Some(bits) = self.inner.coerce::<T, Lsb0>() {

{
#[inline]
fn len(&self) -> usize {

@@ -2245,2 +2316,3 @@ self.inner.count_ones()

{
#[inline]
fn default() -> Self {

@@ -2263,2 +2335,3 @@ Self {

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -2296,2 +2369,3 @@ let pos = if let Some(bits) = self.inner.coerce::<T, Lsb0>() {

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -2402,2 +2476,3 @@ let pos = if let Some(bits) = self.inner.coerce::<T, Lsb0>() {

/// [`T::Mem`]: crate::store::BitStore::Mem
#[inline]
#[must_use = "You must consume this object, preferably immediately \

@@ -2418,2 +2493,3 @@ upon creation"]

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -2423,2 +2499,3 @@ self.inner.next().map(|item| unsafe { $map(item) })

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -2428,2 +2505,3 @@ self.inner.nth(n).map(|item| unsafe { $map(item) })

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {

@@ -2433,2 +2511,3 @@ self.inner.size_hint()

#[inline]
fn count(self) -> usize {

@@ -2438,2 +2517,3 @@ self.inner.count()

#[inline]
fn last(self) -> Option<Self::Item> {

@@ -2451,2 +2531,3 @@ self.inner.last().map(|item| unsafe { $map(item) })

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -2456,2 +2537,3 @@ self.inner.next_back().map(|item| unsafe { $map(item) })

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -2469,2 +2551,3 @@ self.inner.nth_back(n).map(|item| unsafe { $map(item) })

{
#[inline]
fn len(&self) -> usize {

@@ -2536,2 +2619,3 @@ self.inner.len()

/// [0]: crate::slice::ChunksExactMut::into_remainder
#[inline]
pub fn into_remainder(self) -> &'a mut BitSlice<T, O> {

@@ -2544,2 +2628,3 @@ unsafe { BitSlice::unalias_mut(self.inner.into_remainder()) }

/// [0]: crate::slice::ChunksExactMut::take_remainder
#[inline]
pub fn take_remainder(&mut self) -> &'a mut BitSlice<T, O> {

@@ -2558,2 +2643,3 @@ unsafe { BitSlice::unalias_mut(self.inner.take_remainder()) }

/// [0]: crate::slice::RChunksExactMut::into_remainder
#[inline]
pub fn into_remainder(self) -> &'a mut BitSlice<T, O> {

@@ -2566,2 +2652,3 @@ unsafe { BitSlice::unalias_mut(self.inner.into_remainder()) }

/// [0]: crate::slice::RChunksExactMut::take_remainder
#[inline]
pub fn take_remainder(&mut self) -> &'a mut BitSlice<T, O> {

@@ -2568,0 +2655,0 @@ unsafe { BitSlice::unalias_mut(self.inner.take_remainder()) }

@@ -42,2 +42,3 @@ #![doc = include_str!("../../doc/slice/ops.md")]

{
#[inline]
#[doc = include_str!("../../doc/slice/bitop_assign.md")]

@@ -74,2 +75,3 @@ fn bitand_assign(&mut self, rhs: &BitSlice<T2, O2>) {

{
#[inline]
#[doc = include_str!("../../doc/slice/bitop_assign.md")]

@@ -103,2 +105,3 @@ fn bitor_assign(&mut self, rhs: &BitSlice<T2, O2>) {

{
#[inline]
#[doc = include_str!("../../doc/slice/bitop_assign.md")]

@@ -157,2 +160,3 @@ fn bitxor_assign(&mut self, rhs: &BitSlice<T2, O2>) {

/// ```
#[inline]
fn index(&self, index: usize) -> &Self::Output {

@@ -176,2 +180,3 @@ match *index.index(self) {

#[inline]
#[track_caller]

@@ -188,2 +193,3 @@ fn index(&self, index: $t) -> &Self::Output {

{
#[inline]
#[track_caller]

@@ -219,2 +225,3 @@ fn index_mut(&mut self, index: $t) -> &mut Self::Output {

#[inline]
fn not(self) -> Self::Output {

@@ -221,0 +228,0 @@ match self.domain_mut() {

@@ -41,2 +41,3 @@ #![doc = include_str!("../../doc/slice/specialization.md")]

/// aliasing.
#[inline]
fn as_accessor(&mut self) -> &BitSlice<T::Access, O> {

@@ -43,0 +44,0 @@ unsafe { &*(self as *const Self as *const BitSlice<T::Access, O>) }

@@ -103,4 +103,4 @@ //! Specializations for `BitSlice<_, Lsb0>.

for (from, to) in from.zip(to).bidi(rev) {
let value = (&*from).load_le::<usize>();
(&mut *to).store_le::<usize>(value);
let value = (*from).load_le::<usize>();
(*to).store_le::<usize>(value);
}

@@ -107,0 +107,0 @@ }

@@ -101,4 +101,4 @@ //! Specializations for `BitSlice<_, Msb0>.

for (from, to) in from.zip(to).bidi(rev) {
let value = (&*from).load_be::<usize>();
(&mut *to).store_be::<usize>(value);
let value = (*from).load_be::<usize>();
(*to).store_be::<usize>(value);
}

@@ -105,0 +105,0 @@ }

@@ -679,1 +679,26 @@ #![cfg(test)]

}
#[test]
fn trait_impls() {
use core::iter::FusedIterator;
use static_assertions::*;
use crate::slice::iter::{
BitRefIter,
BitValIter,
};
assert_impl_all!(
BitRefIter<'static, usize, Lsb0>: Iterator,
DoubleEndedIterator,
ExactSizeIterator,
FusedIterator
);
assert_impl_all!(
BitValIter<'static, usize, Lsb0>: Iterator,
DoubleEndedIterator,
ExactSizeIterator,
FusedIterator
);
}

@@ -49,2 +49,3 @@ #![doc = include_str!("../../doc/slice/traits.md")]

{
#[inline]
fn as_ref(&self) -> &Self {

@@ -61,2 +62,3 @@ self

{
#[inline]
fn as_mut(&mut self) -> &mut Self {

@@ -81,2 +83,3 @@ self

{
#[inline]
fn cmp(&self, rhs: &Self) -> cmp::Ordering {

@@ -104,2 +107,3 @@ self.partial_cmp(rhs)

{
#[inline]
fn eq(&self, rhs: &BitSlice<T2, O2>) -> bool {

@@ -136,2 +140,3 @@ if let (Some(this), Some(that)) =

{
#[inline]
fn eq(&self, rhs: &BitSlice<T2, O2>) -> bool {

@@ -149,2 +154,3 @@ **self == rhs

{
#[inline]
fn eq(&self, rhs: &BitSlice<T2, O2>) -> bool {

@@ -164,2 +170,3 @@ **self == rhs

{
#[inline]
fn eq(&self, rhs: &&BitSlice<T2, O2>) -> bool {

@@ -177,2 +184,3 @@ *self == **rhs

{
#[inline]
fn eq(&self, rhs: &&mut BitSlice<T2, O2>) -> bool {

@@ -199,2 +207,3 @@ *self == **rhs

{
#[inline]
fn partial_cmp(&self, rhs: &BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -221,2 +230,3 @@ for (l, r) in self.iter().by_vals().zip(rhs.iter().by_vals()) {

{
#[inline]
fn partial_cmp(&self, rhs: &BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -234,2 +244,3 @@ (*self).partial_cmp(rhs)

{
#[inline]
fn partial_cmp(&self, rhs: &BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -249,2 +260,3 @@ (**self).partial_cmp(rhs)

{
#[inline]
fn partial_cmp(&self, rhs: &&BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -262,2 +274,3 @@ (*self).partial_cmp(&**rhs)

{
#[inline]
fn partial_cmp(&self, rhs: &&mut BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -277,2 +290,3 @@ (*self).partial_cmp(&**rhs)

{
#[inline]
fn partial_cmp(&self, rhs: &&mut BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -290,2 +304,3 @@ (**self).partial_cmp(&**rhs)

{
#[inline]
fn partial_cmp(&self, rhs: &&BitSlice<T2, O2>) -> Option<cmp::Ordering> {

@@ -310,2 +325,3 @@ (**self).partial_cmp(&**rhs)

#[inline]
fn try_from(slice: &'a [T]) -> Result<Self, Self::Error> {

@@ -330,2 +346,3 @@ BitSlice::try_from_slice(slice).map_err(|_| slice)

#[inline]
fn try_from(slice: &'a mut [T]) -> Result<Self, Self::Error> {

@@ -344,2 +361,3 @@ let slice_ptr = slice as *mut [T];

{
#[inline]
fn default() -> Self {

@@ -356,2 +374,3 @@ BitSlice::empty()

{
#[inline]
fn default() -> Self {

@@ -368,2 +387,3 @@ BitSlice::empty_mut()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -381,2 +401,3 @@ self.as_bitspan().render(fmt, "Slice", None)?;

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -394,2 +415,3 @@ fmt.debug_list()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -465,2 +487,3 @@ Pointer::fmt(&self.as_bitspan(), fmt)

{
#[inline]
#[allow(clippy::modulo_one)] // I know what I’m doing.

@@ -537,2 +560,3 @@ // TODO(myrrlyn): See if Binary codegen ditches the loops.

{
#[inline]
fn hash<H>(&self, hasher: &mut H)

@@ -578,2 +602,3 @@ where H: Hasher {

#[inline]
fn to_owned(&self) -> Self::Owned {

@@ -580,0 +605,0 @@ BitVec::from_bitslice(self)

@@ -74,2 +74,3 @@ #![doc = include_str!("../doc/store.md")]

/// [`BitAccess`]: crate::access::BitAccess
#[inline]
fn get_bit<O>(&self, index: BitIdx<Self::Mem>) -> bool

@@ -112,4 +113,6 @@ where O: BitOrder {

#[inline]
fn new(value: Self::Mem) -> Self { value }
#[inline]
fn load_value(&self) -> Self::Mem {

@@ -119,2 +122,3 @@ *self

#[inline]
fn store_value(&mut self, value: Self::Mem) {

@@ -139,4 +143,6 @@ *self = value;

#[inline]
fn new(value: Self::Mem) -> Self { <Self>::new(value) }
#[inline]
fn load_value(&self) -> Self::Mem {

@@ -146,2 +152,3 @@ self.load()

#[inline]
fn store_value(&mut self, value: Self::Mem) {

@@ -165,4 +172,6 @@ *self = Self::new(value);

#[inline]
fn new(value: Self::Mem) -> Self { <Self>::new(value) }
#[inline]
fn load_value(&self) -> Self::Mem {

@@ -172,2 +181,3 @@ self.get()

#[inline]
fn store_value(&mut self, value: Self::Mem) {

@@ -210,4 +220,6 @@ *self = Self::new(value);

#[inline]
fn new(value: Self::Mem) -> Self { <Self>::new(value) }
#[inline]
fn load_value(&self) -> Self::Mem {

@@ -217,2 +229,3 @@ self.load(core::sync::atomic::Ordering::Relaxed)

#[inline]
fn store_value(&mut self, value: Self::Mem) {

@@ -219,0 +232,0 @@ *self = Self::new(value);

@@ -87,2 +87,3 @@ #![doc = include_str!("../doc/vec.md")]

/// ```
#[inline]
pub fn repeat(bit: bool, len: usize) -> Self {

@@ -120,2 +121,3 @@ let mut out = Self::with_capacity(len);

/// [`.force_align()`]: Self::force_align
#[inline]
pub fn from_bitslice(slice: &BitSlice<T, O>) -> Self {

@@ -154,2 +156,3 @@ let bitspan = slice.as_bitspan();

/// ```
#[inline]
pub fn from_element(elem: T) -> Self {

@@ -177,2 +180,3 @@ Self::from_vec(vec![elem])

/// ```
#[inline]
pub fn from_slice(slice: &[T]) -> Self {

@@ -197,2 +201,3 @@ Self::try_from_slice(slice).unwrap()

/// ```
#[inline]
pub fn try_from_slice(slice: &[T]) -> Result<Self, BitSpanError<T>> {

@@ -220,2 +225,3 @@ BitSlice::<T, O>::try_from_slice(slice).map(Self::from_bitslice)

/// ```
#[inline]
pub fn from_vec(vec: Vec<T>) -> Self {

@@ -242,2 +248,3 @@ Self::try_from_vec(vec)

/// It is not practical to allocate a vector that will fail this conversion.
#[inline]
pub fn try_from_vec(vec: Vec<T>) -> Result<Self, Vec<T>> {

@@ -281,2 +288,3 @@ let mut vec = ManuallyDrop::new(vec);

/// [`.extend()`]: https://docs.rs/bitvec/latest/bitvec/vec/struct.Vec.html#impl-Extend
#[inline]
pub fn extend_from_bitslice<T2, O2>(&mut self, other: &BitSlice<T2, O2>)

@@ -301,2 +309,3 @@ where

/// [`Vec::extend_from_slice`](alloc::vec::Vec::extend_from_slice)
#[inline]
pub fn extend_from_raw_slice(&mut self, slice: &[T]) {

@@ -314,2 +323,3 @@ self.extend_from_bitslice(slice.view_bits::<O>());

/// Explicitly views the bit-vector as a bit-slice.
#[inline]
pub fn as_bitslice(&self) -> &BitSlice<T, O> {

@@ -320,2 +330,3 @@ unsafe { self.bitspan.into_bitslice_ref() }

/// Explicitly views the bit-vector as a mutable bit-slice.
#[inline]
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<T, O> {

@@ -326,2 +337,3 @@ unsafe { self.bitspan.into_bitslice_mut() }

/// Views the bit-vector as a slice of its underlying memory elements.
#[inline]
pub fn as_raw_slice(&self) -> &[T] {

@@ -335,2 +347,3 @@ let (data, len) =

/// elements.
#[inline]
pub fn as_raw_mut_slice(&mut self) -> &mut [T] {

@@ -353,2 +366,3 @@ let (data, len) =

/// for more details.
#[inline]
pub fn as_bitptr(&self) -> BitPtr<Const, T, O> {

@@ -369,2 +383,3 @@ self.bitspan.to_bitptr().to_const()

/// for more details.
#[inline]
pub fn as_mut_bitptr(&mut self) -> BitPtr<Mut, T, O> {

@@ -390,2 +405,3 @@ self.bitspan.to_bitptr()

/// ```
#[inline]
pub fn into_boxed_bitslice(self) -> BitBox<T, O> {

@@ -421,2 +437,3 @@ let mut bitspan = self.bitspan;

/// [`.set_uninitialized()`]: Self::set_uninitialized
#[inline]
pub fn into_vec(self) -> Vec<T> {

@@ -473,2 +490,3 @@ let (bitspan, capacity) = (self.bitspan, self.capacity);

/// [`.as_raw_slice()`]: Self::as_raw_slice
#[inline]
pub fn set_elements(&mut self, element: T::Mem) {

@@ -511,2 +529,3 @@ self.as_raw_mut_slice()

/// [`.as_raw_slice()`]: Self::as_raw_slice
#[inline]
pub fn set_uninitialized(&mut self, value: bool) {

@@ -548,2 +567,3 @@ let head = self.bitspan.head().into_inner() as usize;

/// ```
#[inline]
pub fn force_align(&mut self) {

@@ -594,2 +614,3 @@ let mut bitspan = self.bitspan;

/// This panics if `len` is too large to encode into a `BitSpan`.
#[inline]
fn assert_len_encodable(len: usize) {

@@ -620,2 +641,3 @@ assert!(

/// bits have been given initialized memory.
#[inline]
fn do_reservation(

@@ -652,2 +674,3 @@ &mut self,

/// and capacity.
#[inline]
fn with_vec<F, R>(&mut self, func: F) -> R

@@ -654,0 +677,0 @@ where F: FnOnce(&mut ManuallyDrop<Vec<T>>) -> R {

@@ -63,2 +63,3 @@ //! Port of the `Vec<bool>` inherent API.

/// [`.reserve()`]: Self::reserve
#[inline]
pub fn new() -> Self {

@@ -102,2 +103,3 @@ Self::EMPTY

/// [`BitSlice::MAX_BITS`]: crate::slice::BitSlice::MAX_BITS
#[inline]
pub fn with_capacity(capacity: usize) -> Self {

@@ -145,2 +147,3 @@ Self::assert_len_encodable(capacity);

/// [`.into_raw_parts()`]: Self::into_raw_parts
#[inline]
pub unsafe fn from_raw_parts(

@@ -176,2 +179,3 @@ bitptr: BitPtr<Mut, T, O>,

/// [`::from_raw_parts()`]: Self::from_raw_parts
#[inline]
pub fn into_raw_parts(self) -> (BitPtr<Mut, T, O>, usize, usize) {

@@ -207,2 +211,3 @@ let this = ManuallyDrop::new(self);

/// [`.force_align()`]: Self::force_align
#[inline]
pub fn capacity(&self) -> usize {

@@ -245,2 +250,3 @@ self.capacity

/// ```
#[inline]
pub fn reserve(&mut self, additional: usize) {

@@ -283,2 +289,3 @@ Self::assert_len_encodable(self.len() + additional);

/// [`.reserve()`]: Self::reserve
#[inline]
pub fn reserve_exact(&mut self, additional: usize) {

@@ -295,3 +302,3 @@ self.do_reservation(additional, Vec::<T>::reserve_exact);

///
/// [`Vec::reserve_exact`](alloc::vec::Vec::reserve_exact)
/// [`Vec::shrink_to_fit`](alloc::vec::Vec::shrink_to_fit)
///

@@ -309,2 +316,3 @@ /// ## Examples

/// [`.reserve_exact()`]: Self::reserve_exact
#[inline]
pub fn shrink_to_fit(&mut self) {

@@ -314,2 +322,3 @@ self.with_vec(|vec| vec.shrink_to_fit());

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -359,2 +368,3 @@ #[deprecated = "prefer `.into_boxed_bitslice() instead"]

/// [`.drain()`]: Self::drain
#[inline]
pub fn truncate(&mut self, new_len: usize) {

@@ -368,2 +378,3 @@ if new_len < self.len() {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -376,2 +387,3 @@ #[deprecated = "use `.as_bitslice()` instead"]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -384,2 +396,3 @@ #[deprecated = "use `.as_mut_bitslice()` instead"]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -392,2 +405,3 @@ #[deprecated = "use `.as_bitptr()` instead"]

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -445,2 +459,3 @@ #[deprecated = "use `.as_mut_bitptr()` instead"]

/// [`.capacity()`]: Self::capacity
#[inline]
pub unsafe fn set_len(&mut self, new_len: usize) {

@@ -479,2 +494,3 @@ let capa = self.capacity();

/// ```
#[inline]
pub fn swap_remove(&mut self, index: usize) -> bool {

@@ -503,2 +519,3 @@ self.assert_in_bounds(index, 0 .. self.len());

/// This panics if `index` is out of bounds (including `self.len()`).
#[inline]
pub fn insert(&mut self, index: usize, value: bool) {

@@ -522,2 +539,3 @@ self.assert_in_bounds(index, 0 ..= self.len());

/// This panics if `index` is out of bounds (excluding `self.len()`).
#[inline]
pub fn remove(&mut self, index: usize) -> bool {

@@ -558,2 +576,3 @@ self.assert_in_bounds(index, 0 .. self.len());

/// ```
#[inline]
pub fn retain<F>(&mut self, mut func: F)

@@ -617,2 +636,3 @@ where F: FnMut(usize, &bool) -> bool {

/// ```
#[inline]
pub fn push(&mut self, value: bool) {

@@ -651,2 +671,3 @@ let len = self.len();

/// ```
#[inline]
pub fn pop(&mut self) -> Option<bool> {

@@ -696,2 +717,3 @@ match self.len() {

/// ```
#[inline]
pub fn append<T2, O2>(&mut self, other: &mut BitVec<T2, O2>)

@@ -759,2 +781,3 @@ where

/// ```
#[inline]
pub fn clear(&mut self) {

@@ -773,2 +796,3 @@ self.truncate(0);

/// [`Vec::len`](alloc::vec::Vec::len)
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -788,2 +812,3 @@ pub fn len(&self) -> usize {

/// [`Vec::is_empty`](alloc::vec::Vec::is_empty)
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -810,2 +835,3 @@ pub fn is_empty(&self) -> bool {

/// ```
#[inline]
pub fn split_off(&mut self, at: usize) -> Self {

@@ -847,2 +873,3 @@ let len = self.len();

/// ```
#[inline]
pub fn resize_with<F>(&mut self, new_len: usize, mut func: F)

@@ -876,3 +903,3 @@ where F: FnMut(usize) -> bool {

///
/// [`Vec::len`](alloc::vec::Vec::len)
/// [`Vec::leak`](alloc::vec::Vec::leak)
///

@@ -895,2 +922,3 @@ /// ## Examples

/// [`BitBox::leak`]: crate::boxed::BitBox::leak
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -917,2 +945,3 @@ pub fn leak<'a>(self) -> &'a mut BitSlice<T, O> {

/// ```
#[inline]
pub fn resize(&mut self, new_len: usize, value: bool) {

@@ -932,2 +961,3 @@ let len = self.len();

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -965,2 +995,3 @@ #[allow(missing_docs, clippy::missing_docs_in_private_items)]

/// ```
#[inline]
pub fn extend_from_within<R>(&mut self, src: R)

@@ -1021,2 +1052,3 @@ where R: RangeExt<usize> {

/// [`self.drain()`]: Self::drain
#[inline]
pub fn splice<R, I>(

@@ -1023,0 +1055,0 @@ &mut self,

@@ -51,2 +51,3 @@ #![doc = include_str!("../../doc/vec/iter.md")]

{
#[inline]
fn extend<I>(&mut self, iter: I)

@@ -87,2 +88,3 @@ where I: IntoIterator<Item = bool> {

{
#[inline]
fn extend<I>(&mut self, iter: I)

@@ -104,2 +106,3 @@ where I: IntoIterator<Item = &'a bool> {

{
#[inline]
fn extend<I>(&mut self, iter: I)

@@ -116,2 +119,3 @@ where I: IntoIterator<Item = BitRef<'a, M, T2, O2>> {

{
#[inline]
fn extend<I>(&mut self, iter: I)

@@ -134,2 +138,3 @@ where I: IntoIterator<Item = T> {

{
#[inline]
fn extend<I>(&mut self, iter: I)

@@ -152,2 +157,3 @@ where I: IntoIterator<Item = &'a T> {

{
#[inline]
fn from_iter<I>(iter: I) -> Self

@@ -165,2 +171,3 @@ where I: IntoIterator<Item = bool> {

{
#[inline]
fn from_iter<I>(iter: I) -> Self

@@ -183,2 +190,3 @@ where I: IntoIterator<Item = &'a bool> {

{
#[inline]
fn from_iter<I>(iter: I) -> Self

@@ -196,2 +204,3 @@ where I: IntoIterator<Item = BitRef<'a, M, T2, O2>> {

{
#[inline]
fn from_iter<I>(iter: I) -> Self

@@ -209,2 +218,3 @@ where I: IntoIterator<Item = T> {

{
#[inline]
fn from_iter<I>(iter: I) -> Self

@@ -228,2 +238,3 @@ where I: IntoIterator<Item = &'a T> {

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -244,2 +255,3 @@ self.into_boxed_bitslice().into_iter()

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -260,2 +272,3 @@ self.as_bitslice().iter()

#[inline]
fn into_iter(self) -> Self::IntoIter {

@@ -322,2 +335,3 @@ self.as_mut_bitslice().iter_mut()

/// [`Drain::as_slice`](alloc::vec::Drain::as_slice)
#[inline]
#[cfg(not(tarpaulin_include))]

@@ -328,2 +342,3 @@ pub fn as_bitslice(&self) -> &'a BitSlice<T, O> {

#[inline]
#[cfg(not(tarpaulin_include))]

@@ -347,2 +362,3 @@ #[deprecated = "use `.as_bitslice()` instead"]

/// [`Splice`]: crate::vec::Splice
#[inline]
fn fill(&mut self, iter: &mut impl Iterator<Item = bool>) -> FillStatus {

@@ -416,2 +432,3 @@ let bv = &mut *self.source;

{
#[inline]
fn as_ref(&self) -> &BitSlice<T, O> {

@@ -428,2 +445,3 @@ self.as_bitslice()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -445,2 +463,3 @@ fmt.debug_tuple("Drain").field(&self.as_bitslice()).finish()

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -450,2 +469,3 @@ self.drain.next().map(|bp| unsafe { bp.read() })

#[inline]
fn nth(&mut self, n: usize) -> Option<Self::Item> {

@@ -463,2 +483,3 @@ self.drain.nth(n).map(|bp| unsafe { bp.read() })

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -468,2 +489,3 @@ self.drain.next_back().map(|bp| unsafe { bp.read() })

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -481,2 +503,3 @@ self.drain.nth_back(n).map(|bp| unsafe { bp.read() })

{
#[inline]
fn len(&self) -> usize {

@@ -520,2 +543,3 @@ self.drain.len()

{
#[inline]
fn drop(&mut self) {

@@ -588,2 +612,3 @@ let tail = mem::take(&mut self.tail);

#[inline]
fn next(&mut self) -> Option<Self::Item> {

@@ -608,2 +633,3 @@ self.drain.next().tap_some(|_| unsafe {

{
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {

@@ -613,2 +639,3 @@ self.drain.next_back()

#[inline]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {

@@ -626,2 +653,3 @@ self.drain.nth_back(n)

{
#[inline]
fn len(&self) -> usize {

@@ -647,2 +675,3 @@ self.drain.len()

{
#[inline]
fn drop(&mut self) {

@@ -649,0 +678,0 @@ let tail = self.drain.tail.clone();

@@ -36,2 +36,3 @@ //! Operator trait implementations for bit-vectors.

{
#[inline]
fn bitand_assign(&mut self, rhs: BitVec<T, O>) {

@@ -48,2 +49,3 @@ *self &= rhs.as_bitslice()

{
#[inline]
fn bitand_assign(&mut self, rhs: &BitVec<T, O>) {

@@ -63,2 +65,3 @@ *self &= rhs.as_bitslice()

#[inline]
fn bitand(mut self, rhs: Rhs) -> Self::Output {

@@ -77,2 +80,3 @@ self &= rhs;

{
#[inline]
fn bitand_assign(&mut self, rhs: Rhs) {

@@ -89,2 +93,3 @@ *self.as_mut_bitslice() &= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: BitVec<T, O>) {

@@ -101,2 +106,3 @@ *self |= rhs.as_bitslice()

{
#[inline]
fn bitor_assign(&mut self, rhs: &BitVec<T, O>) {

@@ -116,2 +122,3 @@ *self |= rhs.as_bitslice()

#[inline]
fn bitor(mut self, rhs: Rhs) -> Self::Output {

@@ -130,2 +137,3 @@ self |= rhs;

{
#[inline]
fn bitor_assign(&mut self, rhs: Rhs) {

@@ -142,2 +150,3 @@ *self.as_mut_bitslice() |= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: BitVec<T, O>) {

@@ -154,2 +163,3 @@ *self ^= rhs.as_bitslice()

{
#[inline]
fn bitxor_assign(&mut self, rhs: &BitVec<T, O>) {

@@ -169,2 +179,3 @@ *self ^= rhs.as_bitslice()

#[inline]
fn bitxor(mut self, rhs: Rhs) -> Self::Output {

@@ -183,2 +194,3 @@ self ^= rhs;

{
#[inline]
fn bitxor_assign(&mut self, rhs: Rhs) {

@@ -196,2 +208,3 @@ *self.as_mut_bitslice() ^= rhs;

#[inline]
fn deref(&self) -> &Self::Target {

@@ -207,2 +220,3 @@ self.as_bitslice()

{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {

@@ -218,2 +232,3 @@ self.as_mut_bitslice()

{
#[inline]
fn drop(&mut self) {

@@ -235,2 +250,3 @@ if self.bitspan != BitSpan::<Mut, T, O>::EMPTY {

#[inline]
fn index(&self, index: Idx) -> &Self::Output {

@@ -248,2 +264,3 @@ &self.as_bitslice()[index]

{
#[inline]
fn index_mut(&mut self, index: Idx) -> &mut Self::Output {

@@ -265,2 +282,3 @@ &mut self.as_mut_bitslice()[index]

#[inline]
fn not(mut self) -> Self::Output {

@@ -267,0 +285,0 @@ for elem in self.as_raw_mut_slice() {

@@ -46,2 +46,3 @@ //! General trait implementations for bit-vectors.

{
#[inline]
fn borrow(&self) -> &BitSlice<T, O> {

@@ -58,2 +59,3 @@ self.as_bitslice()

{
#[inline]
fn borrow_mut(&mut self) -> &mut BitSlice<T, O> {

@@ -70,2 +72,3 @@ self.as_mut_bitslice()

{
#[inline]
fn clone(&self) -> Self {

@@ -89,2 +92,3 @@ Self::from_bitslice(self.as_bitslice())

{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {

@@ -103,2 +107,3 @@ self.as_bitslice().cmp(other.as_bitslice())

{
#[inline]
fn eq(&self, other: &BitVec<T2, O2>) -> bool {

@@ -117,2 +122,3 @@ self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &BitVec<T2, O2>) -> bool {

@@ -131,2 +137,3 @@ *self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &BitVec<T2, O2>) -> bool {

@@ -144,2 +151,3 @@ **self == other.as_bitslice()

{
#[inline]
fn eq(&self, other: &Rhs) -> bool {

@@ -158,2 +166,3 @@ other == self.as_bitslice()

{
#[inline]
fn partial_cmp(&self, other: &BitVec<T2, O2>) -> Option<cmp::Ordering> {

@@ -172,2 +181,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &BitVec<T2, O2>) -> Option<cmp::Ordering> {

@@ -186,2 +196,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &BitVec<T2, O2>) -> Option<cmp::Ordering> {

@@ -199,2 +210,3 @@ self.partial_cmp(other.as_bitslice())

{
#[inline]
fn partial_cmp(&self, other: &Rhs) -> Option<cmp::Ordering> {

@@ -211,2 +223,3 @@ other.partial_cmp(self.as_bitslice())

{
#[inline]
fn as_ref(&self) -> &BitSlice<T, O> {

@@ -223,2 +236,3 @@ self.as_bitslice()

{
#[inline]
fn as_mut(&mut self) -> &mut BitSlice<T, O> {

@@ -235,2 +249,3 @@ self.as_mut_bitslice()

{
#[inline]
fn as_ref(&self) -> &Self {

@@ -247,2 +262,3 @@ self

{
#[inline]
fn as_mut(&mut self) -> &mut Self {

@@ -259,2 +275,3 @@ self

{
#[inline]
fn from(slice: &BitSlice<T, O>) -> Self {

@@ -271,2 +288,3 @@ Self::from_bitslice(slice)

{
#[inline]
fn from(slice: &mut BitSlice<T, O>) -> Self {

@@ -283,2 +301,3 @@ Self::from_bitslice(slice)

{
#[inline]
fn from(array: BitArray<A, O>) -> Self {

@@ -295,2 +314,3 @@ array.as_bitslice().to_owned()

{
#[inline]
fn from(boxed: BitBox<T, O>) -> Self {

@@ -307,2 +327,3 @@ boxed.into_bitvec()

{
#[inline]
fn from(bv: BitVec<T, O>) -> Self {

@@ -319,2 +340,3 @@ bv.into_vec()

{
#[inline]
fn from(cow: Cow<'a, BitSlice<T, O>>) -> Self {

@@ -333,2 +355,3 @@ cow.into_owned()

#[inline]
fn try_from(vec: Vec<T>) -> Result<Self, Self::Error> {

@@ -345,2 +368,3 @@ Self::try_from_vec(vec)

{
#[inline]
fn default() -> Self {

@@ -356,2 +380,3 @@ Self::new()

{
#[inline]
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {

@@ -383,2 +408,3 @@ self.as_bitspan().render(fmt, "Vec", &[(

{
#[inline]
fn hash<H>(&self, state: &mut H)

@@ -385,0 +411,0 @@ where H: Hasher {

@@ -79,2 +79,3 @@ #![doc = include_str!("../doc/view.md")]

#[inline]
fn view_bits<O>(&self) -> &BitSlice<T, O>

@@ -85,2 +86,3 @@ where O: BitOrder {

#[inline]
fn try_view_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>

@@ -91,2 +93,3 @@ where O: BitOrder {

#[inline]
fn view_bits_mut<O>(&mut self) -> &mut BitSlice<T, O>

@@ -97,2 +100,3 @@ where O: BitOrder {

#[inline]
fn try_view_bits_mut<O>(

@@ -113,2 +117,3 @@ &mut self,

#[inline]
fn view_bits<O>(&self) -> &BitSlice<T, O>

@@ -119,2 +124,3 @@ where O: BitOrder {

#[inline]
fn try_view_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>

@@ -125,2 +131,3 @@ where O: BitOrder {

#[inline]
fn view_bits_mut<O>(&mut self) -> &mut BitSlice<T, O>

@@ -131,2 +138,3 @@ where O: BitOrder {

#[inline]
fn try_view_bits_mut<O>(

@@ -146,2 +154,3 @@ &mut self,

/// Wraps `self` in a `BitArray`.
#[inline]
fn into_bitarray<O>(self) -> BitArray<Self, O>

@@ -164,2 +173,3 @@ where O: BitOrder {

#[inline]
fn as_raw_slice(&self) -> &[Self::Store] {

@@ -169,2 +179,3 @@ slice::from_ref(self)

#[inline]
fn as_raw_mut_slice(&mut self) -> &mut [Self::Store] {

@@ -180,2 +191,3 @@ slice::from_mut(self)

#[inline]
fn as_raw_slice(&self) -> &[Self::Store] {

@@ -185,2 +197,3 @@ &self[..]

#[inline]
fn as_raw_mut_slice(&mut self) -> &mut [Self::Store] {

@@ -231,2 +244,3 @@ &mut self[..]

{
#[inline]
fn as_bits<O>(&self) -> &BitSlice<T, O>

@@ -237,2 +251,3 @@ where O: BitOrder {

#[inline]
fn try_as_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>

@@ -250,2 +265,3 @@ where O: BitOrder {

{
#[inline]
fn as_mut_bits<O>(&mut self) -> &mut BitSlice<T, O>

@@ -256,2 +272,3 @@ where O: BitOrder {

#[inline]
fn try_as_mut_bits<O>(

@@ -258,0 +275,0 @@ &mut self,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display