File: slice.md

package info (click to toggle)
rust-coreutils 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 505,620 kB
  • sloc: ansic: 103,594; asm: 28,570; sh: 8,910; python: 5,581; makefile: 472; cpp: 97; javascript: 72
file content (34 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Bit-Addressable Memory Regions

This module defines the [`BitSlice`] region, which forms the primary export item
of the crate. It is a region of memory that addresses each bit individually, and
is analogous to the slice language item. See `BitSlice`’s documentation for
information on its use.

The other data structures `bitvec` offers are built atop `BitSlice`, and follow
the development conventions outlined in this module. Because the API surface for
`bitvec` data structures is so large, they are broken into a number of common
submodules:

- `slice` defines the `BitSlice` data structure, its inherent methods
  that are original to `bitvec`, as well as some free functions.
- `slice::api` defines ports of the `impl<T> [T]` inherent blocks from
  `core::slice`.
- `slice::iter` contains all the logic used to iterate across `BitSlices`,
  including ports of `core::slice` iterators.
- `slice::ops` contains implementations of `core::ops` traits that power
  operator sigils.
- `slice::traits` contains all the other trait implementations.
- `slice::tests` contains unit tests for `BitSlice` inherent methods.

Additionally, `slice` has a submodule unique to it: `specialization` contains
override functions that provide faster behavior on known `BitOrder`
implementations. Since the other data structures `Deref` to it, they do not need
to implement bit-order specializations of their own.

All ports of language or standard-library items have an `## Original` section in
their documentation that links to the item they are porting, and possibly an
`## API Differences` that explains why the `bitvec` item is not a drop-in
replacement.

[`BitSlice`]: self::BitSlice