pub trait Leb128ReadExt: ByteInput {
Show 24 methods
// Provided methods
fn read_uleb_u8_non_strict(&mut self) -> Result<u8> { ... }
fn read_uleb_u8_strict(&mut self) -> Result<u8> { ... }
fn read_uleb_u16_non_strict(&mut self) -> Result<u16> { ... }
fn read_uleb_u16_strict(&mut self) -> Result<u16> { ... }
fn read_uleb_u32_non_strict(&mut self) -> Result<u32> { ... }
fn read_uleb_u32_strict(&mut self) -> Result<u32> { ... }
fn read_uleb_u64_non_strict(&mut self) -> Result<u64> { ... }
fn read_uleb_u64_strict(&mut self) -> Result<u64> { ... }
fn read_uleb_u128_non_strict(&mut self) -> Result<u128> { ... }
fn read_uleb_u128_strict(&mut self) -> Result<u128> { ... }
fn read_uleb_usize_non_strict(&mut self) -> Result<usize> { ... }
fn read_uleb_usize_strict(&mut self) -> Result<usize> { ... }
fn read_sleb_i8_non_strict(&mut self) -> Result<i8> { ... }
fn read_sleb_i8_strict(&mut self) -> Result<i8> { ... }
fn read_sleb_i16_non_strict(&mut self) -> Result<i16> { ... }
fn read_sleb_i16_strict(&mut self) -> Result<i16> { ... }
fn read_sleb_i32_non_strict(&mut self) -> Result<i32> { ... }
fn read_sleb_i32_strict(&mut self) -> Result<i32> { ... }
fn read_sleb_i64_non_strict(&mut self) -> Result<i64> { ... }
fn read_sleb_i64_strict(&mut self) -> Result<i64> { ... }
fn read_sleb_i128_non_strict(&mut self) -> Result<i128> { ... }
fn read_sleb_i128_strict(&mut self) -> Result<i128> { ... }
fn read_sleb_isize_non_strict(&mut self) -> Result<isize> { ... }
fn read_sleb_isize_strict(&mut self) -> Result<isize> { ... }
}Expand description
Extension methods for reading LEB128 integers from byte streams.
§Target-width integers
usize and isize methods use the current Rust target’s pointer width.
Prefer fixed-width integer methods such as
Self::read_uleb_u64_non_strict or Self::read_sleb_i64_non_strict for
persistent files and cross-platform protocols. Non-strict methods use the
_non_strict suffix; canonical-only methods use the corresponding _strict
suffix.
A failed synchronous read may have consumed part of the current value.
Do not blindly retry the same operation; resume only from a framing
boundary or a trusted seek checkpoint.
§Examples
A non-strict read accepts an overlong encoding that the strict method rejects:
use std::io::Cursor;
use std::io::ErrorKind;
use qubit_io_binary::Leb128ReadExt;
let mut permissive = Cursor::new([0x80, 0x00]);
assert_eq!(permissive.read_uleb_u64_non_strict()?, 0);
let mut strict = Cursor::new([0x80, 0x00]);
assert_eq!(strict.read_uleb_u64_strict().unwrap_err().kind(), ErrorKind::InvalidData);Provided Methods§
Sourcefn read_uleb_u8_non_strict(&mut self) -> Result<u8>
fn read_uleb_u8_non_strict(&mut self) -> Result<u8>
Sourcefn read_uleb_u8_strict(&mut self) -> Result<u8>
fn read_uleb_u8_strict(&mut self) -> Result<u8>
Sourcefn read_uleb_u16_non_strict(&mut self) -> Result<u16>
fn read_uleb_u16_non_strict(&mut self) -> Result<u16>
Sourcefn read_uleb_u16_strict(&mut self) -> Result<u16>
fn read_uleb_u16_strict(&mut self) -> Result<u16>
Sourcefn read_uleb_u32_non_strict(&mut self) -> Result<u32>
fn read_uleb_u32_non_strict(&mut self) -> Result<u32>
Sourcefn read_uleb_u32_strict(&mut self) -> Result<u32>
fn read_uleb_u32_strict(&mut self) -> Result<u32>
Sourcefn read_uleb_u64_non_strict(&mut self) -> Result<u64>
fn read_uleb_u64_non_strict(&mut self) -> Result<u64>
Sourcefn read_uleb_u64_strict(&mut self) -> Result<u64>
fn read_uleb_u64_strict(&mut self) -> Result<u64>
Sourcefn read_uleb_u128_non_strict(&mut self) -> Result<u128>
fn read_uleb_u128_non_strict(&mut self) -> Result<u128>
Sourcefn read_uleb_u128_strict(&mut self) -> Result<u128>
fn read_uleb_u128_strict(&mut self) -> Result<u128>
Sourcefn read_uleb_usize_non_strict(&mut self) -> Result<usize>
fn read_uleb_usize_non_strict(&mut self) -> Result<usize>
Sourcefn read_uleb_usize_strict(&mut self) -> Result<usize>
fn read_uleb_usize_strict(&mut self) -> Result<usize>
Sourcefn read_sleb_i8_non_strict(&mut self) -> Result<i8>
fn read_sleb_i8_non_strict(&mut self) -> Result<i8>
Sourcefn read_sleb_i8_strict(&mut self) -> Result<i8>
fn read_sleb_i8_strict(&mut self) -> Result<i8>
Sourcefn read_sleb_i16_non_strict(&mut self) -> Result<i16>
fn read_sleb_i16_non_strict(&mut self) -> Result<i16>
Sourcefn read_sleb_i16_strict(&mut self) -> Result<i16>
fn read_sleb_i16_strict(&mut self) -> Result<i16>
Sourcefn read_sleb_i32_non_strict(&mut self) -> Result<i32>
fn read_sleb_i32_non_strict(&mut self) -> Result<i32>
Sourcefn read_sleb_i32_strict(&mut self) -> Result<i32>
fn read_sleb_i32_strict(&mut self) -> Result<i32>
Sourcefn read_sleb_i64_non_strict(&mut self) -> Result<i64>
fn read_sleb_i64_non_strict(&mut self) -> Result<i64>
Sourcefn read_sleb_i64_strict(&mut self) -> Result<i64>
fn read_sleb_i64_strict(&mut self) -> Result<i64>
Sourcefn read_sleb_i128_non_strict(&mut self) -> Result<i128>
fn read_sleb_i128_non_strict(&mut self) -> Result<i128>
Sourcefn read_sleb_i128_strict(&mut self) -> Result<i128>
fn read_sleb_i128_strict(&mut self) -> Result<i128>
Sourcefn read_sleb_isize_non_strict(&mut self) -> Result<isize>
fn read_sleb_isize_non_strict(&mut self) -> Result<isize>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".