Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
# Immutable Bit View
This trait is an analogue to the [`AsRef`] trait, in that it enables any type to
provide a view of an immutable bit-slice.
It does not require an `AsRef<[T: BitStore]>` implementation, but a blanket
implementation for all `AsRef<[T: BitStore]>` is provided. This allows you to
choose whether to implement only one of `AsBits<T>` or `AsRef<[T]>`, and gain
a bit-slice view through either choice.
## Usage
The `.as_bits<_>()` method has the same usage patterns as
[`BitView::view_bits`][0].
## Notes
You are not *forbidden* from creating multiple views with different element
types to the same region, but doing so is likely to cause inconsistent and
surprising behavior.
Refrain from implementing this trait with more than one storage argument unless
you are sure that you can uphold the memory region requirements of all of them,
and are aware of the behavior conflicts that may arise.
[0]: crate::view::BitView::view_bits
[`AsRef`]: core::convert::AsRef
+27
View File
@@ -0,0 +1,27 @@
# Mutable Bit View
This trait is an analogue to the [`AsMut`] trait, in that it enables any type to
provide a view of a mutable bit-slice.
It does not require an `AsMut<[T: BitStore]>` implementation, but a blanket
implementation for all `AsMut<[T: BitStore]>` is provided. This allows you to
choose whether to implement only one of `AsMutBits<T>` or `AsMut<[T]>`, and gain
a bit-slice view through either choice.
## Usage
The `.as_mut_bits<_>()` method has the same usage patterns as
[`BitView::view_bits_mut`][0].
## Notes
You are not *forbidden* from creating multiple views with different element
types to the same region, but doing so is likely to cause inconsistent and
surprising behavior.
Refrain from implementing this trait with more than one storage argument unless
you are sure that you can uphold the memory region requirements of all of them,
and are aware of the behavior conflicts that may arise.
[0]: crate::view::BitView::view_bits_mut
[`AsMut`]: core::convert::AsMut
+27
View File
@@ -0,0 +1,27 @@
# Bit View
This trait describes a region of memory that can be viewed as its constituent
bits. It is blanket-implemented on all [`BitStore`] implementors, as well as
slices and arrays of them. It should not be implemented on any other types.
The contained extension methods allow existing memory to be easily viewd as
[`BitSlice`]s using dot-call method syntax rather than the more cumbersome
constructor functions in `BitSlice`s inherent API.
Since the element type is already known to the implementor, the only type
parameter you need to provide when calling these methods is the bit-ordering.
## Examples
```rust
use bitvec::prelude::*;
let a = 0u16;
let a_bits: &BitSlice<u16, Lsb0> = a.view_bits::<Lsb0>();
let mut b = [0u8; 4];
let b_bits: &mut BitSlice<u8, Msb0> = b.view_bits_mut::<Msb0>();
```
[`BitSlice`]: crate::slice::BitSlice
[`BitStore`]: crate::store::BitStore