std::encoding::binary¶
Status: experimental
Big/little-endian integer packing and varint codecs.
API details and source¶
The implementation source contains the complete declarations and implementation notes. The table below lists canonical Gossamer call signatures; every item name links directly to its implementation file.
| Item | Canonical signature or declaration | Description |
|---|---|---|
get_u16_be |
fn get_u16_be(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a big-endian u16. |
get_u16_le |
fn get_u16_le(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a little-endian u16. |
get_u32_be |
fn get_u32_be(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a big-endian u32. |
get_u32_le |
fn get_u32_le(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a little-endian u32. |
get_u64_be |
fn get_u64_be(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a big-endian u64. |
get_u64_le |
fn get_u64_le(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a little-endian u64. |
get_u8 |
fn get_u8(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Reads a single byte. |
put_u16_be |
fn put_u16_be(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a big-endian u16. |
put_u16_le |
fn put_u16_le(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a little-endian u16. |
put_u32_be |
fn put_u32_be(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a big-endian u32. |
put_u32_le |
fn put_u32_le(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a little-endian u32. |
put_u64_be |
fn put_u64_be(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a big-endian u64. |
put_u64_le |
fn put_u64_le(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a little-endian u64. |
put_u8 |
fn put_u8(buf: Vec<u8>, value: i64) -> Vec<u8> |
Writes a single byte. |
put_uvarint |
fn put_uvarint(buf: Vec<u8>, value: i64) -> Vec<u8> |
Encodes an unsigned varint. |
put_varint |
fn put_varint(buf: Vec<u8>, value: i64) -> Vec<u8> |
Encodes a signed varint (zigzag). |
uvarint |
fn uvarint(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Decodes an unsigned varint. |
varint |
fn varint(bytes: Vec<u8>) -> Result<i64, errors::Error> |
Decodes a signed varint (zigzag). |