gleebor

Types

pub type CborError {
  PrematureEOF
  InvalidMajorArg(Int)
  IncorrectType(major_type: Int)
  MalformedUTF8
}

Constructors

  • PrematureEOF

    Indicates the input ended prematurely and decoding could not continue.

  • InvalidMajorArg(Int)

    This indicates that the major type in the payload was one that is not valid according to the CBOR specification. See RFC 8949 section 3.

  • IncorrectType(major_type: Int)

    Indicates the type decoded did not match the expected type.

    Arguments

    • major_type

      the major_type is the CBOR Section 3.1 Major Types indicator.

  • MalformedUTF8

Functions

pub fn decode_bytes(
  a: BitArray,
) -> Result(#(BitArray, BitArray), CborError)

Decodes an array of bytes

pub fn decode_int(
  a: BitArray,
) -> Result(#(Int, BitArray), CborError)
pub fn decode_list(
  buffer a: BitArray,
  with f: fn(BitArray) -> Result(#(a, BitArray), CborError),
) -> Result(
  Iterator(Result(#(a, BitArray), CborError)),
  CborError,
)

Decodes a homogenous array or list of items from BitArray using the provided callback function.

pub fn decode_string(
  a: BitArray,
) -> Result(#(String, BitArray), CborError)
Search Document