gamqp/amqp091/internal/codec
Encoding and decoding of AMQP 0-9-1 primitive domains and field tables.
Types
A decoder consumes a prefix of its input and returns the remainder.
pub type Decoded(a) =
Result(#(a, BitArray), Nil)
One argument of a method or content header, in wire order.
pub type Field {
Octet(Int)
Short(Int)
Long(Int)
LongLong(Int)
ShortStr(String)
LongStr(BitArray)
Bits(List(Bool))
FieldTable(List(#(String, table.FieldValue)))
}
Constructors
-
Octet(Int) -
Short(Int) -
Long(Int) -
LongLong(Int) -
ShortStr(String) -
LongStr(BitArray) -
Bits(List(Bool))Consecutive bit arguments, packed least significant bit first.
-
FieldTable(List(#(String, table.FieldValue)))
Values
pub fn bits(
bits: BitArray,
count: Int,
) -> Result(#(List(Bool), BitArray), Nil)
Decodes an octet of packed bits; count is how many are meaningful.
pub fn encode_table(
t: List(#(String, table.FieldValue)),
) -> Result(BitArray, String)
pub fn entries(
bits: BitArray,
acc: List(#(String, table.FieldValue)),
) -> Result(List(#(String, table.FieldValue)), Nil)
Decodes a table’s entries when its size prefix has already been removed.
pub fn field_table(
bits: BitArray,
) -> Result(#(List(#(String, table.FieldValue)), BitArray), Nil)
pub fn long_string(b: BitArray) -> BitArray
pub fn short_string(s: String) -> Result(BitArray, String)
pub fn table_entries(
t: List(#(String, table.FieldValue)),
) -> Result(BitArray, String)
A table’s entries without the leading size, as AMQPLAIN credentials need.