nimiq/serde

Values

pub fn deserialize_bitarray(
  buf: BitArray,
  length: Int,
) -> Result(#(BitArray, BitArray), String)

Reads a BitArray of the given length from the BitArray.

pub fn deserialize_bool(
  buf: BitArray,
) -> Result(#(Bool, BitArray), String)

Deserializes a boolean from the BitArray.

pub fn deserialize_bytes(
  buf: BitArray,
) -> Result(#(BitArray, BitArray), String)

Decodes a variable length byte array, reading its length from a varint prefix.

pub fn deserialize_string(
  buf: BitArray,
) -> Result(#(String, BitArray), String)

Decodes a variable length string, reading its length from a varint prefix.

pub fn deserialize_u16(
  buf: BitArray,
) -> Result(#(Int, BitArray), String)

Deserializes an u16 from the BitArray.

pub fn deserialize_u32(
  buf: BitArray,
) -> Result(#(Int, BitArray), String)

Deserializes an u32 from the BitArray.

pub fn deserialize_u64(
  buf: BitArray,
) -> Result(#(Int, BitArray), String)

Deserializes an u64 from the BitArray.

pub fn deserialize_u8(
  buf: BitArray,
) -> Result(#(Int, BitArray), String)

Deserializes an u8 from the BitArray.

pub fn serialize_bitarray(
  buf: bytes_tree.BytesTree,
  data: BitArray,
) -> bytes_tree.BytesTree

Appends a BitArray to the BytesTree.

pub fn serialize_bool(
  buf: bytes_tree.BytesTree,
  value: Bool,
) -> bytes_tree.BytesTree

Serializes a boolean into the BytesTree.

pub fn serialize_bytes(
  buf: bytes_tree.BytesTree,
  data: BitArray,
) -> bytes_tree.BytesTree

Encodes a variable length byte array with its length as a varint prefix.

pub fn serialize_string(
  buf: bytes_tree.BytesTree,
  str: String,
) -> bytes_tree.BytesTree

Encodes a variable length string with its length as a varint prefix.

pub fn serialize_u16(
  buf: bytes_tree.BytesTree,
  num: Int,
) -> bytes_tree.BytesTree

Serializes an u16 into the BytesTree.

pub fn serialize_u32(
  buf: bytes_tree.BytesTree,
  num: Int,
) -> bytes_tree.BytesTree

Serializes an u32 into the BytesTree.

pub fn serialize_u64(
  buf: bytes_tree.BytesTree,
  num: Int,
) -> bytes_tree.BytesTree

Serializes an u64 into the BytesTree.

pub fn serialize_u8(
  buf: bytes_tree.BytesTree,
  num: Int,
) -> bytes_tree.BytesTree

Serializes an u8 into the BytesTree.

Search Document