| 1 |
# Bit-Slice Operator Implementations |
| 2 |
|
| 3 |
The standard-library slices only implement the indexing operator `[]`. |
| 4 |
`BitSlice` additionally implements the Boolean operators `&`, `|`, `^`, and `!`. |
| 5 |
|
| 6 |
The dyadic Boolean arithmetic operators all take any `bitvec` container as their |
| 7 |
second argument, and apply the operation in-place to the left-hand bit-slice. If |
| 8 |
the second argument exhausts before `self` does, then it is implicitly |
| 9 |
zero-extended. This means that `&=` zeros excess bits in `self`, while `|=` and |
| 10 |
`^=` do not modify them. |
| 11 |
|
| 12 |
The monadic operator `!` inverts the entire bit-slice at once. Its API requires |
| 13 |
*taking* a `&mut BitSlice` reference and returning it, so you will need to |
| 14 |
structure your code accordingly. |
| 15 |
|
| 16 |
[`BitSlice::domain_mut`]: crate::slice::BitSlice::domain_mut |