Skip to main content

re_emit_bits

Function re_emit_bits 

Source
pub fn re_emit_bits(
    dst: &mut BitWriter,
    src_bytes: &[u8],
    bit_len: usize,
) -> Result<(), Error>
Expand description

Reads exactly bit_len MSB-first bits from src_bytes and appends them to dst. Bits are sourced as if src_bytes were the output of a BitWriter finalized with into_bytes() (so the trailing partial byte is in the high bits of the last source byte). The destination is extended in-place — no padding inserted.

Generalizes the read-bits-then-write-bits pattern used by the TLV encoder when re-emitting a sub-bitstream’s bits into the outer wire without 1-bit drift on non-byte-aligned boundaries.