8 releases (breaking)

0.6.0 Apr 29, 2024
0.5.0 Feb 7, 2024
0.4.0 Jun 20, 2023
0.3.0 Sep 20, 2022
0.0.1 Sep 14, 2022

#40 in #parity

Download history 24090/week @ 2024-06-05 26123/week @ 2024-06-12 25293/week @ 2024-06-19 27988/week @ 2024-06-26 29409/week @ 2024-07-03 27662/week @ 2024-07-10 38127/week @ 2024-07-17 38369/week @ 2024-07-24 31311/week @ 2024-07-31 43089/week @ 2024-08-07 40391/week @ 2024-08-14 35718/week @ 2024-08-21 44092/week @ 2024-08-28 43860/week @ 2024-09-04 46321/week @ 2024-09-11 44861/week @ 2024-09-18

186,653 downloads per month
Used in 114 crates (8 directly)

Apache-2.0

49KB
828 lines

scale-bits · CI Status Latest Version on Crates.io Released API docs

This small utility crate provides two separate things:

  1. A Bits type that can be SCALE encoded and decoded, and is fully SCALE compatible with a BitVec<u8, Lsb0>. It's a deliberately simple type that is conceptually just a sequence of bools, and can be used as a replacement for BitVec when you don't need the additional complexity and functionality that it comes with. See the bits module for more.
  2. Utility methods to help encode and decode arbitrary bit sequences from their SCALE representation, or skip over the corresponding bytes entirely, with zero allocations. These bypass the need to first go via some BitVec with the right store/order type, and are WASM compatible (unlike BitVec's u64 store type). See the scale module for more.

These things play nicely together (ie you can encode and decode arbitrary bit sequences directly into the Bits type), but don't need to be used together.

Dependencies

~2–3MB
~61K SLoC