[][src]Module ecpdap::bitvec

This module contains convenience functions for manipulating Vec and &bool.

Enums

Error

Functions

append_bit

Append a single bit from a u8 (0 or 1) to a Vec.

append_u8

Append a u8 to a Vec, least significant bit first.

append_u16

Append a u16 to a Vec, least significant bit first.

append_u32

Append a u32 to a Vec, least significant bit first.

append_word

Append n bits from a u64 to a Vec, least significant bit first.

bits_to_bytes

Convert a slice of bits to a Vec of u8s, least-significant-bit first.

byte_to_bits

Convert a single byte to a Vec of bool.

bytes_to_bits

Convert a slice of u8 to a Vec of bool, least-significant-bit first. Reads exactly n bits; returns an error if n>bytes.len()*8.

drain_bit

Extract the next bit as a u8.

drain_u8

Extract the next 8 bits as a u8.

drain_u16

Extract the next 16 bits as a u16.

drain_u32

Extract the next 32 bits as a u32.

drain_word

Extracts the next n bits as a u64, least significant bit first, with any higher order bits set to 0. Returns the extracted word and any remaining bits.

Type Definitions

Result