API reference Dodo 0.1.4

std/bytes

Public declarations, types, methods, and source contracts for std/bytes.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/bytes"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
raw core/bytes bytes.dodo

RangeError

Enum · Source

Byte offsets/counts, never scalar or grapheme indices. No allocation.

pub enum RangeError {
    OutOfBounds
}

check_range

Function · Source

pub fn check_range(length: usize, offset: usize, count: usize) -> void!RangeError

view

Function · Source

pub fn view(data: &[u8], offset: usize, count: usize) -> &[u8]!RangeError from(data)

view_mut

Function · Source

pub fn view_mut(data: &mut[u8], offset: usize, count: usize) -> &mut[u8]!RangeError from(data)

find

Function · Source

pub fn find(data: &[u8], needle: &[u8]) -> Option<usize>

rfind

Function · Source

pub fn rfind(data: &[u8], needle: &[u8]) -> Option<usize>

find_byte

Function · Source

pub fn find_byte(data: &[u8], value: u8) -> Option<usize>

equal

Function · Source

pub fn equal(left: &[u8], right: &[u8]) -> bool

compare

Function · Source

pub fn compare(left: &[u8], right: &[u8]) -> i32

starts_with

Function · Source

pub fn starts_with(data: &[u8], prefix: &[u8]) -> bool

ends_with

Function · Source

pub fn ends_with(data: &[u8], suffix: &[u8]) -> bool

Reader

Struct · Source

pub struct Reader {
    // Private implementation fields omitted.
}

Reader.new

Function · Source

pub fn new(data: &[u8]) -> Reader from(data)

Reader.position

Function · Source

pub fn position(&self) -> usize

Reader.remaining

Function · Source

pub fn remaining(&self) -> usize

Reader.rest

Function · Source

pub fn rest(&self) -> &[u8]from(self)

Reader.seek

Function · Source

pub fn seek(&mut self, position: usize) -> void!RangeError

Reader.skip

Function · Source

pub fn skip(&mut self, count: usize) -> void!RangeError

Reader.take

Function · Source

A failed operation leaves position unchanged.

pub fn take(&mut self, count: usize) -> &[u8]!RangeError from(self)

Reader.read_u8

Function · Source

pub fn read_u8(&mut self) -> u8!RangeError

Reader.read_u16_le

Function · Source

pub fn read_u16_le(&mut self) -> u16!RangeError

Reader.read_u16_be

Function · Source

pub fn read_u16_be(&mut self) -> u16!RangeError

Reader.read_u32_le

Function · Source

pub fn read_u32_le(&mut self) -> u32!RangeError

Reader.read_u32_be

Function · Source

pub fn read_u32_be(&mut self) -> u32!RangeError

Reader.read_u64_le

Function · Source

pub fn read_u64_le(&mut self) -> u64!RangeError

Reader.read_u64_be

Function · Source

pub fn read_u64_be(&mut self) -> u64!RangeError

Writer

Struct · Source

pub struct Writer {
    // Private implementation fields omitted.
}

Writer.new

Function · Source

pub fn new(data: &mut[u8]) -> Writer from(data)

Writer.position

Function · Source

pub fn position(&self) -> usize

Writer.remaining

Function · Source

pub fn remaining(&self) -> usize

Writer.written

Function · Source

pub fn written(&self) -> &[u8]from(self)

Writer.seek

Function · Source

pub fn seek(&mut self, position: usize) -> void!RangeError

Writer.put

Function · Source

Full range is validated before any byte changes.

pub fn put(&mut self, data: &[u8]) -> void!RangeError

Writer.write_u8

Function · Source

pub fn write_u8(&mut self, value: u8) -> void!RangeError

Writer.write_u16_le

Function · Source

pub fn write_u16_le(&mut self, value: u16) -> void!RangeError

Writer.write_u16_be

Function · Source

pub fn write_u16_be(&mut self, value: u16) -> void!RangeError

Writer.write_u32_le

Function · Source

pub fn write_u32_le(&mut self, value: u32) -> void!RangeError

Writer.write_u32_be

Function · Source

pub fn write_u32_be(&mut self, value: u32) -> void!RangeError

Writer.write_u64_le

Function · Source

pub fn write_u64_le(&mut self, value: u64) -> void!RangeError

Writer.write_u64_be

Function · Source

pub fn write_u64_be(&mut self, value: u64) -> void!RangeError

read_u16_le

Function · Source

pub fn read_u16_le(data: &[u8], offset: usize) -> u16!RangeError

write_u16_le

Function · Source

pub fn write_u16_le(data: &mut[u8], offset: usize, value: u16) -> void!RangeError

read_u16_be

Function · Source

pub fn read_u16_be(data: &[u8], offset: usize) -> u16!RangeError

write_u16_be

Function · Source

pub fn write_u16_be(data: &mut[u8], offset: usize, value: u16) -> void!RangeError

read_u32_le

Function · Source

pub fn read_u32_le(data: &[u8], offset: usize) -> u32!RangeError

write_u32_le

Function · Source

pub fn write_u32_le(data: &mut[u8], offset: usize, value: u32) -> void!RangeError

read_u32_be

Function · Source

pub fn read_u32_be(data: &[u8], offset: usize) -> u32!RangeError

write_u32_be

Function · Source

pub fn write_u32_be(data: &mut[u8], offset: usize, value: u32) -> void!RangeError

read_u64_le

Function · Source

pub fn read_u64_le(data: &[u8], offset: usize) -> u64!RangeError

write_u64_le

Function · Source

pub fn write_u64_le(data: &mut[u8], offset: usize, value: u64) -> void!RangeError

read_u64_be

Function · Source

pub fn read_u64_be(data: &[u8], offset: usize) -> u64!RangeError

write_u64_be

Function · Source

pub fn write_u64_be(data: &mut[u8], offset: usize, value: u64) -> void!RangeError

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?