yabase/base2

Values

pub fn decode(
  input: String,
) -> Result(BitArray, error.CodecError)

Decode a binary string to a BitArray. Input length must be a multiple of 8. Only “0” and “1” are valid.

pub fn encode(data: BitArray) -> String

Encode a BitArray to a binary string (e.g. <<0x41>> -> “01000001”).

Sub-byte input (a BitArray whose bit size is not a multiple of 8) panics; the byte-walker would otherwise silently drop the trailing fewer-than-8-bit segment. See yabase/core/guard.assert_byte_aligned.

Search Document