Skip to content

std.bytes

le/be fixed-width ints at any offset in a byte slice; no alignment needed checked in every build mode: .out_of_bounds, and nothing read or written

pub BytesError :: errors {
out_of_bounds,
}
  • out_of_bounds: value would run past the slice end
pub read_u8 :: fn(self: []const u8, off: usize) -> u8 ! BytesError
pub write_u8 :: fn(self: []u8, off: usize, v: u8) -> void ! BytesError
pub read_u16_le :: fn(self: []const u8, off: usize) -> u16 ! BytesError
pub read_u16_be :: fn(self: []const u8, off: usize) -> u16 ! BytesError
pub read_u32_le :: fn(self: []const u8, off: usize) -> u32 ! BytesError
pub read_u32_be :: fn(self: []const u8, off: usize) -> u32 ! BytesError
pub read_u64_le :: fn(self: []const u8, off: usize) -> u64 ! BytesError
pub read_u64_be :: fn(self: []const u8, off: usize) -> u64 ! BytesError
pub write_u16_le :: fn(self: []u8, off: usize, v: u16) -> void ! BytesError
pub write_u16_be :: fn(self: []u8, off: usize, v: u16) -> void ! BytesError
pub write_u32_le :: fn(self: []u8, off: usize, v: u32) -> void ! BytesError
pub write_u32_be :: fn(self: []u8, off: usize, v: u32) -> void ! BytesError
pub write_u64_le :: fn(self: []u8, off: usize, v: u64) -> void ! BytesError
pub write_u64_be :: fn(self: []u8, off: usize, v: u64) -> void ! BytesError