Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · binary

Docs

std/binary

On this page

Index

Functions

u16_be

fn u16_be(n: Int) -> Bytes

The low 16 bits of n, big endian (2 bytes); also the 32 (4 bytes) and 64 bit (8 bytes) forms and little endian ones.

Source: std/binary.xo:9

u32_be

fn u32_be(n: Int) -> Bytes

Source: std/binary.xo:10

u64_be

fn u64_be(n: Int) -> Bytes

Source: std/binary.xo:11

u16_le

fn u16_le(n: Int) -> Bytes

Source: std/binary.xo:12

u32_le

fn u32_le(n: Int) -> Bytes

Source: std/binary.xo:13

u64_le

fn u64_le(n: Int) -> Bytes

Source: std/binary.xo:14

get_u16_be

fn get_u16_be(b: Bytes, at: Int) -> Int

The unsigned 16 bit value at byte at, big endian; faults when the bytes run past the end. Also the 32 and 64 bit and little endian forms.

Source: std/binary.xo:18

get_u32_be

fn get_u32_be(b: Bytes, at: Int) -> Int

Source: std/binary.xo:19

get_u64_be

fn get_u64_be(b: Bytes, at: Int) -> Int

Source: std/binary.xo:20

get_u16_le

fn get_u16_le(b: Bytes, at: Int) -> Int

Source: std/binary.xo:21

get_u32_le

fn get_u32_le(b: Bytes, at: Int) -> Int

Source: std/binary.xo:22

get_u64_le

fn get_u64_le(b: Bytes, at: Int) -> Int

Source: std/binary.xo:23

get_i16_be

fn get_i16_be(b: Bytes, at: Int) -> Int

The same, sign extended (Go’s int16(binary.BigEndian.Uint16(b))).

Source: std/binary.xo:25

get_i32_be

fn get_i32_be(b: Bytes, at: Int) -> Int

Source: std/binary.xo:26

get_i16_le

fn get_i16_le(b: Bytes, at: Int) -> Int

Source: std/binary.xo:27

get_i32_le

fn get_i32_le(b: Bytes, at: Int) -> Int

Source: std/binary.xo:28

uvarint

fn uvarint(n: Int) -> Bytes

n as an unsigned 64 bit word in the varint encoding (binary.AppendUvarint).

Source: std/binary.xo:31

varint

fn varint(n: Int) -> Bytes

n zig-zag encoded (binary.AppendVarint).

Source: std/binary.xo:33

get_uvarint

fn get_uvarint(b: Bytes, at: Int) -> (Int, Int)?

The value at byte at and the bytes it took; None when the input ends first or the value overflows 64 bits (binary.Uvarint’s n <= 0).

Source: std/binary.xo:36

get_varint

fn get_varint(b: Bytes, at: Int) -> (Int, Int)?

Source: std/binary.xo:37

↑ index