Debian Codegraph @

debian/rust-vendor/bitvec/doc/view/AsMutBits.md

raw
1 # Mutable Bit View
2
3 This trait is an analogue to the [`AsMut`] trait, in that it enables any type to
4 provide a view of a mutable bit-slice.
5
6 It does not require an `AsMut<[T: BitStore]>` implementation, but a blanket
7 implementation for all `AsMut<[T: BitStore]>` is provided. This allows you to
8 choose whether to implement only one of `AsMutBits<T>` or `AsMut<[T]>`, and gain
9 a bit-slice view through either choice.
10
11 ## Usage
12
13 The `.as_mut_bits<_>()` method has the same usage patterns as
14 [`BitView::view_bits_mut`][0].
15
16 ## Notes
17
18 You are not *forbidden* from creating multiple views with different element
19 types to the same region, but doing so is likely to cause inconsistent and
20 surprising behavior.
21
22 Refrain from implementing this trait with more than one storage argument unless
23 you are sure that you can uphold the memory region requirements of all of them,
24 and are aware of the behavior conflicts that may arise.
25
26 [0]: crate::view::BitView::view_bits_mut
27 [`AsMut`]: core::convert::AsMut