Skip to content

@binary

Import this module with import @binary.

Binary encoding/decoding for integers and floats in little-endian (le) and big-endian (be) formats. Each encode_<T> function takes a value of type T and returns its bytes as [u8]; each decode_<T> function takes [u8] and returns a T.

Function Description
encode_i8, decode_i8 Signed 8-bit
encode_u8, decode_u8 Unsigned 8-bit
Function Description
encode_i16_le, encode_i16_be, decode_i16_le, decode_i16_be Signed 16-bit
encode_u16_le, encode_u16_be, decode_u16_le, decode_u16_be Unsigned 16-bit
Function Description
encode_i32_le, encode_i32_be, decode_i32_le, decode_i32_be Signed 32-bit
encode_u32_le, encode_u32_be, decode_u32_le, decode_u32_be Unsigned 32-bit
Function Description
encode_i64_le, encode_i64_be, decode_i64_le, decode_i64_be Signed 64-bit
encode_u64_le, encode_u64_be, decode_u64_le, decode_u64_be Unsigned 64-bit
Function Description
encode_i128_le, encode_i128_be, decode_i128_le, decode_i128_be Signed 128-bit
encode_u128_le, encode_u128_be, decode_u128_le, decode_u128_be Unsigned 128-bit
Function Description
encode_i256_le, encode_i256_be, decode_i256_le, decode_i256_be Signed 256-bit
encode_u256_le, encode_u256_be, decode_u256_le, decode_u256_be Unsigned 256-bit
Function Description
encode_f32_le, encode_f32_be, decode_f32_le, decode_f32_be 32-bit float
encode_f64_le, encode_f64_be, decode_f64_le, decode_f64_be 64-bit float