[][src]Crate packed_integers

packed_integers provides a growable array for integer types in the range u1 to u31.

Use case

Assume you have a sequence of unsigned integers in the range [0, 100000] that you would like to hold in memory. That range of values can be represented using 17 bits per integer, since 217 - 1 = 131071. As Rust has no u17 type, you would typically store these values in a u32 array, wasting 15 bits per integer.

packed_integers helps alleviate this issue by packing these integers at the bit level, essentially trading time for space.

API

Where possible, packed_integers mimics the API for Rust's Vec in order to provide a set of methods you're probably already familiar with.

Macros

packed_ints

A macro for a more convenient initialisation of PackedIntegers.

Structs

PackedIntegers

A growable array of packed integers, backed by a Vec<u32> buffer.

PackedIntegersIntoIterator

A consuming iterator for PackedIntegers.

PackedIntegersIterator

An iterator for PackedIntegers.

Enums

U1
U2
U3
U4
U5
U6
U7
U8
U9
U10
U11
U12
U13
U14
U15
U16
U17
U18
U19
U20
U21
U22
U23
U24
U25
U26
U27
U28
U29
U30
U31

Traits

PackedInt

A trait for packed integer types.