acrostic/decoding

Types

pub type BasicDecoder(value) =
  fn(BitArray) -> Result(value, String)
pub type FieldDecoder(value) {
  FieldDecoder(wire_type: WireType, decode: BasicDecoder(value))
}

Constructors

  • FieldDecoder(wire_type: WireType, decode: BasicDecoder(value))
pub type Key {
  Key(field_number: Int, wire_type: WireType)
}

Constructors

  • Key(field_number: Int, wire_type: WireType)

Constants

pub const bool_field_decoder: FieldDecoder(Bool)
pub const i32_field_decoder: FieldDecoder(Float)
pub const i64_field_decoder: FieldDecoder(Float)
pub const int_field_decoder: FieldDecoder(Int)
pub const string_field_decoder: FieldDecoder(String)

Functions

pub fn decode_field(
  binary: BitArray,
  wire_type: WireType,
  decoder: FieldDecoder(a),
) -> Result(#(a, BitArray), String)
pub fn decode_repeated_field(
  binary: BitArray,
  wire_type: WireType,
  decoder: FieldDecoder(a),
) -> Result(#(List(a), BitArray), String)
pub fn read_key(
  binary: BitArray,
) -> Result(#(Key, BitArray), String)
pub fn to_varint(binary: BitArray, acc: Int) -> Int
Search Document