Debian Codegraph @

debian/rust-vendor/bitvec/doc/serdes/utils.md

raw
1 # De/Serialization Assistants
2
3 This module contains types and implementations that assist in the
4 de/serialization of the crate’s primary data structures.
5
6 ## `BitIdx<R>`
7
8 The `BitIdx` implementation serializes both the index value and also the
9 bit-width of `T::Mem`, so that the deserializer can ensure that it only loads
10 from a matching data buffer.
11
12 ## `Array<T, N>`
13
14 Serde only provides implementations for `[T; 0 ..= 32]`, because it must support
15 much older Rust versions (at time of writing, 1.15+) that do not have
16 const-generics. As `bitvec` has an MSRV of 1.56; it *does* have const-generics.
17 This type reïmplements Serde’s array behavior for all arrays, so that `bitvec`
18 can transport any `BitArray` rather than only small bit-arrays.
19
20 ## `Domain<Const, T, O>`
21
22 `BitSlice` serializes its data buffer by using `Domain` to produce a sequence of
23 elements. While the length is always known, and is additionally carried in the
24 crate metadata ahead of the data buffer, `Domain` uses Serde’s sequence model in
25 order to allow the major implementations to use the provided slice or vector
26 deserializers, rather than rebuilding even more logic from scratch.