7 releases (breaking)

0.5.0 Feb 7, 2024
0.4.0 Jun 20, 2023
0.3.0 Sep 20, 2022
0.2.0 Sep 16, 2022
0.0.1 Sep 14, 2022

#769 in Magic Beans

Download history 4151/week @ 2023-12-22 4133/week @ 2023-12-29 6888/week @ 2024-01-05 6063/week @ 2024-01-12 6479/week @ 2024-01-19 7192/week @ 2024-01-26 9209/week @ 2024-02-02 10040/week @ 2024-02-09 8054/week @ 2024-02-16 7432/week @ 2024-02-23 8255/week @ 2024-03-01 8039/week @ 2024-03-08 9518/week @ 2024-03-15 8846/week @ 2024-03-22 10001/week @ 2024-03-29 8069/week @ 2024-04-05

37,719 downloads per month
Used in 71 crates (7 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

~4.5MB
~93K SLoC