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 "core/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.
This package has no source imports.
BufferError
Enum · Source
pub enum BufferError {
OutOfBounds, LengthMismatch
}
equal
Function · Source
pub fn equal(a: &[u8], b: &[u8]) -> bool
compare
Function · Source
Lexicographic byte order, independent of target endianness.
pub fn compare(a: &[u8], b: &[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
find
Function · Source
pub fn find(data: &[u8], value: u8) -> Option<usize>
fill
Function · Source
pub fn fill(data: &mut[u8], value: u8)
reverse
Function · Source
pub fn reverse(data: &mut[u8])
copy_from
Function · Source
Validate first: failure leaves the destination completely unchanged.
pub fn copy_from(destination: &mut[u8], source: &[u8]) -> Result<void, BufferError>
read_u16_le
Function · Source
pub fn read_u16_le(data: &[u8], offset: usize) -> Result<u16, BufferError>
write_u16_le
Function · Source
pub fn write_u16_le(data: &mut[u8], offset: usize, value: u16) -> Result<void, BufferError>
read_u16_be
Function · Source
pub fn read_u16_be(data: &[u8], offset: usize) -> Result<u16, BufferError>
write_u16_be
Function · Source
pub fn write_u16_be(data: &mut[u8], offset: usize, value: u16) -> Result<void, BufferError>
read_u32_le
Function · Source
pub fn read_u32_le(data: &[u8], offset: usize) -> Result<u32, BufferError>
write_u32_le
Function · Source
pub fn write_u32_le(data: &mut[u8], offset: usize, value: u32) -> Result<void, BufferError>
read_u32_be
Function · Source
pub fn read_u32_be(data: &[u8], offset: usize) -> Result<u32, BufferError>
write_u32_be
Function · Source
pub fn write_u32_be(data: &mut[u8], offset: usize, value: u32) -> Result<void, BufferError>
read_u64_le
Function · Source
pub fn read_u64_le(data: &[u8], offset: usize) -> Result<u64, BufferError>
write_u64_le
Function · Source
pub fn write_u64_le(data: &mut[u8], offset: usize, value: u64) -> Result<void, BufferError>
read_u64_be
Function · Source
pub fn read_u64_be(data: &[u8], offset: usize) -> Result<u64, BufferError>
write_u64_be
Function · Source
pub fn write_u64_be(data: &mut[u8], offset: usize, value: u64) -> Result<void, BufferError>