pub struct BufferedBinaryReader<R, O = BigEndian>where
R: ByteInput,{ /* private fields */ }Expand description
Buffered reader for fixed-width binary values.
Scalar reads decode directly from the internal input buffer whenever enough bytes are available, avoiding a per-value temporary byte buffer.
§Buffered state
This reader may prefetch bytes from the wrapped reader. As a result,
Self::inner can observe an underlying stream position ahead of the
logical position exposed by this wrapper.
§Type Parameters
R: Underlying byte input.O: Compile-time byte-order specification.
§Examples
use qubit_codec::BigEndian;
use qubit_io_binary::BufferedBinaryReader;
let mut reader = BufferedBinaryReader::<_, BigEndian>::new(std::io::Cursor::new([0x12, 0x34]));
assert_eq!(reader.read_u16()?, 0x1234);Implementations§
Source§impl<R, O> BufferedBinaryReader<R, O>where
R: ByteInput,
impl<R, O> BufferedBinaryReader<R, O>where
R: ByteInput,
Sourcepub fn is_buffered(&self) -> bool
pub fn is_buffered(&self) -> bool
Returns whether this reader buffers input.
§Returns
Returns true when reads may prefetch bytes into an internal buffer.
Sourcepub unsafe fn read_unchecked(
&mut self,
output: &mut [u8],
index: usize,
count: usize,
) -> Result<usize>
pub unsafe fn read_unchecked( &mut self, output: &mut [u8], index: usize, count: usize, ) -> Result<usize>
Reads up to count bytes into an indexed output range.
§Parameters
output: Destination byte buffer.index: Start of the writable range.count: Maximum number of bytes to read.
§Returns
Returns the number of bytes read; a successful read may be short.
For a non-empty request, Ok(0) means no bytes were available in this
call or the input reached its end; it does not promise permanent EOF.
A successful empty request returns zero without establishing EOF.
Empty requests may still call the underlying input or return an error.
See qubit_io::Input::read_unchecked for the underlying contract.
§Errors
Returns the underlying input error.
§Safety
index..index + count must be a valid range within output.
Sourcepub fn read(&mut self, output: &mut [u8]) -> Result<usize>
pub fn read(&mut self, output: &mut [u8]) -> Result<usize>
Reads bytes into the full output slice.
§Parameters
output: Destination byte buffer.
§Returns
Returns the number of bytes read; a successful read may be short.
For a non-empty request, Ok(0) means no bytes were available in this
call or the input reached its end; it does not promise permanent EOF.
A successful empty request returns zero without establishing EOF.
Empty requests may still call the underlying input or return an error.
See qubit_io::Input::read for the underlying contract.
§Errors
Returns the underlying input error.
Sourcepub unsafe fn read_fully_unchecked(
&mut self,
output: &mut [u8],
index: usize,
count: usize,
) -> Result<usize>
pub unsafe fn read_fully_unchecked( &mut self, output: &mut [u8], index: usize, count: usize, ) -> Result<usize>
Reads bytes into an indexed range until it is full or a read returns zero.
§Parameters
output: Destination byte buffer.index: Start of the writable range.count: Maximum number of bytes to read.
§Returns
Returns the number of bytes read before the range is full or a read returns zero.
§Errors
Returns the underlying input error.
§Safety
index..index + count must be a valid range within output.
Sourcepub fn read_fully(&mut self, output: &mut [u8]) -> Result<usize>
pub fn read_fully(&mut self, output: &mut [u8]) -> Result<usize>
Source§impl<R, O> BufferedBinaryReader<R, O>where
R: SeekableByteInput,
impl<R, O> BufferedBinaryReader<R, O>where
R: SeekableByteInput,
Sourcepub fn seek_to(&mut self, position: SeekFrom) -> Result<u64>
pub fn seek_to(&mut self, position: SeekFrom) -> Result<u64>
Seeks the wrapped byte stream; see Seekable::seek_to for
the seek contract. Buffered wrappers interpret relative offsets
and report positions relative to their logical stream position.
A position query does not flush buffered output.
§Parameters
position: Relative or absolute target position.
§Returns
Returns the resulting stream position in bytes. For buffered wrappers this is the logical position, including buffered data.
§Errors
Returns the underlying seek error.
Source§impl<R, O> BufferedBinaryReader<R, O>where
R: ByteInput,
O: ByteOrderSpec,
impl<R, O> BufferedBinaryReader<R, O>where
R: ByteInput,
O: ByteOrderSpec,
Sourcepub fn with_capacity(inner: R, capacity: usize) -> Self
pub fn with_capacity(inner: R, capacity: usize) -> Self
Sourcepub fn try_with_capacity(
inner: R,
capacity: usize,
) -> Result<Self, TryReserveError>
pub fn try_with_capacity( inner: R, capacity: usize, ) -> Result<Self, TryReserveError>
Tries to create a buffered binary reader with at least capacity bytes.
§Parameters
inner: Underlying byte input to wrap.capacity: Requested internal buffer capacity in bytes. The request is raised when necessary to fit the largest supported codec payload.
§Returns
Returns a buffered reader on successful allocation. Its capacity satisfies both the request and the minimum required by the supported codecs.
§Errors
Returns a TryReserveError if the buffer capacity overflows or its
allocation fails.
Sourcepub const fn byte_order(&self) -> ByteOrder
pub const fn byte_order(&self) -> ByteOrder
Returns the byte order selected by this reader.
§Returns
Returns the compile-time byte order as a runtime value.
Sourcepub const fn inner(&self) -> &R
pub const fn inner(&self) -> &R
Returns a shared reference to the underlying reader.
The underlying reader may already be positioned past unread bytes held in this wrapper’s internal buffer.
§Returns
Returns the wrapped reader.
Sourcepub fn into_parts(self) -> (R, Buffer<u8>)
pub fn into_parts(self) -> (R, Buffer<u8>)
Consumes this wrapper and preserves its unread buffered bytes.
§Returns
Returns the wrapped reader and the buffer whose Buffer::readable
slice contains every prefetched byte not yet consumed logically. To
continue the same logical stream, consume that slice before reading
from the returned reader.
Source§impl<R> BufferedBinaryReader<R, BigEndian>where
R: ByteInput,
impl<R> BufferedBinaryReader<R, BigEndian>where
R: ByteInput,
Sourcepub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u16 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length exceeds max_len or the payload is not
valid UTF-8. Also returns an allocation error if reserving the
payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Sourcepub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u32 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length does not fit usize, exceeds max_len,
or the payload is not valid UTF-8. Also returns an allocation
error if reserving the payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Source§impl<R> BufferedBinaryReader<R, LittleEndian>where
R: ByteInput,
impl<R> BufferedBinaryReader<R, LittleEndian>where
R: ByteInput,
Sourcepub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u16 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length exceeds max_len or the payload is not
valid UTF-8. Also returns an allocation error if reserving the
payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Sourcepub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u32 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length does not fit usize, exceeds max_len,
or the payload is not valid UTF-8. Also returns an allocation
error if reserving the payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Source§impl<R> BufferedBinaryReader<R, NativeEndian>where
R: ByteInput,
impl<R> BufferedBinaryReader<R, NativeEndian>where
R: ByteInput,
Sourcepub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u16_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u16 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length exceeds max_len or the payload is not
valid UTF-8. Also returns an allocation error if reserving the
payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Sourcepub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
pub fn read_string_with_u32_len(&mut self, max_len: usize) -> Result<String>
Reads a UTF-8 string prefixed by a u32 byte length.
§Parameters
max_len: Maximum UTF-8 payload length in bytes, excluding the length prefix.
§Returns
Returns the decoded UTF-8 string.
§Errors
Returns an input error, or std::io::ErrorKind::InvalidData
when the byte length does not fit usize, exceeds max_len,
or the payload is not valid UTF-8. Also returns an allocation
error if reserving the payload buffer fails.
§Stream position
If the decoded length exceeds max_len, the length prefix has been
consumed logically, but the payload has not. If UTF-8 validation
fails, the prefix and complete payload have been consumed logically.
If reserving the payload buffer fails, the length prefix has been
consumed logically, but the payload has not.
The underlying input may already have prefetched payload bytes;
its position is not the logical consumption position. These operations
do not roll back; recover only at an outer framing boundary or a
trusted seek checkpoint. See StringReadExt
for the shared length-prefixed read contract.
Trait Implementations§
Source§impl<R, O> Input for BufferedBinaryReader<R, O>where
R: ByteInput,
impl<R, O> Input for BufferedBinaryReader<R, O>where
R: ByteInput,
Source§fn is_buffered(&self) -> bool
fn is_buffered(&self) -> bool
Source§unsafe fn read_unchecked(
&mut self,
output: &mut [u8],
index: usize,
count: usize,
) -> Result<usize>
unsafe fn read_unchecked( &mut self, output: &mut [u8], index: usize, count: usize, ) -> Result<usize>
Reads up to count bytes into an indexed output range.
§Parameters
output: Destination slice.index: First destination index.count: Maximum number of bytes to read.
§Returns
Returns the number of bytes read.
§Errors
Returns an error reported while reading the buffered input.
§Safety
index..index + count must be a valid range within output.
Source§fn into_std_read(self) -> StdRead<Self> ⓘ
fn into_std_read(self) -> StdRead<Self> ⓘ
Source§fn read(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
fn read(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
Source§unsafe fn read_fully_unchecked(
&mut self,
output: &mut [Self::Item],
index: usize,
count: usize,
) -> Result<usize, Error>
unsafe fn read_fully_unchecked( &mut self, output: &mut [Self::Item], index: usize, count: usize, ) -> Result<usize, Error>
Source§fn read_fully(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
fn read_fully(&mut self, output: &mut [Self::Item]) -> Result<usize, Error>
Source§impl<R, O> Seekable for BufferedBinaryReader<R, O>where
R: SeekableByteInput,
impl<R, O> Seekable for BufferedBinaryReader<R, O>where
R: SeekableByteInput,
Source§fn seek_to(&mut self, position: SeekFrom) -> Result<u64>
fn seek_to(&mut self, position: SeekFrom) -> Result<u64>
Seeks relative to this reader’s logical position. Relative seeks within the buffered window preserve unread bytes; successful seeks outside the window discard the old buffer. The returned position is logical.
§Parameters
position: Target seek position.
§Returns
Returns the new logical stream position in bytes.
§Errors
Returns the seek error reported by the wrapped reader and preserves buffered bytes when seeking fails, including when an in-window seek cannot query the wrapped position.
Auto Trait Implementations§
impl<R, O> Forget for BufferedBinaryReader<R, O>
impl<R, O> Freeze for BufferedBinaryReader<R, O>
impl<R, O> Move for BufferedBinaryReader<R, O>
impl<R, O> RefUnwindSafe for BufferedBinaryReader<R, O>
impl<R, O> Send for BufferedBinaryReader<R, O>
impl<R, O> Sync for BufferedBinaryReader<R, O>
impl<R, O> Unpin for BufferedBinaryReader<R, O>
impl<R, O> UnsafeUnpin for BufferedBinaryReader<R, O>
impl<R, O> UnwindSafe for BufferedBinaryReader<R, O>
Blanket Implementations§
Source§impl<R> BinaryReadExt for R
impl<R> BinaryReadExt for R
Source§fn read_u16(&mut self, byte_order: ByteOrder) -> Result<u16>
fn read_u16(&mut self, byte_order: ByteOrder) -> Result<u16>
Source§fn read_u16_be(&mut self) -> Result<u16>
fn read_u16_be(&mut self) -> Result<u16>
Source§fn read_u16_le(&mut self) -> Result<u16>
fn read_u16_le(&mut self) -> Result<u16>
Source§fn read_u32(&mut self, byte_order: ByteOrder) -> Result<u32>
fn read_u32(&mut self, byte_order: ByteOrder) -> Result<u32>
Source§fn read_u32_be(&mut self) -> Result<u32>
fn read_u32_be(&mut self) -> Result<u32>
Source§fn read_u32_le(&mut self) -> Result<u32>
fn read_u32_le(&mut self) -> Result<u32>
Source§fn read_u64(&mut self, byte_order: ByteOrder) -> Result<u64>
fn read_u64(&mut self, byte_order: ByteOrder) -> Result<u64>
Source§fn read_u64_be(&mut self) -> Result<u64>
fn read_u64_be(&mut self) -> Result<u64>
Source§fn read_u64_le(&mut self) -> Result<u64>
fn read_u64_le(&mut self) -> Result<u64>
Source§fn read_u128(&mut self, byte_order: ByteOrder) -> Result<u128>
fn read_u128(&mut self, byte_order: ByteOrder) -> Result<u128>
Source§fn read_u128_be(&mut self) -> Result<u128>
fn read_u128_be(&mut self) -> Result<u128>
Source§fn read_u128_le(&mut self) -> Result<u128>
fn read_u128_le(&mut self) -> Result<u128>
Source§fn read_i16(&mut self, byte_order: ByteOrder) -> Result<i16>
fn read_i16(&mut self, byte_order: ByteOrder) -> Result<i16>
Source§fn read_i16_le(&mut self) -> Result<i16>
fn read_i16_le(&mut self) -> Result<i16>
Source§fn read_i32(&mut self, byte_order: ByteOrder) -> Result<i32>
fn read_i32(&mut self, byte_order: ByteOrder) -> Result<i32>
Source§fn read_i32_le(&mut self) -> Result<i32>
fn read_i32_le(&mut self) -> Result<i32>
Source§fn read_i64(&mut self, byte_order: ByteOrder) -> Result<i64>
fn read_i64(&mut self, byte_order: ByteOrder) -> Result<i64>
Source§fn read_i64_le(&mut self) -> Result<i64>
fn read_i64_le(&mut self) -> Result<i64>
Source§fn read_i128(&mut self, byte_order: ByteOrder) -> Result<i128>
fn read_i128(&mut self, byte_order: ByteOrder) -> Result<i128>
Source§fn read_i128_be(&mut self) -> Result<i128>
fn read_i128_be(&mut self) -> Result<i128>
Source§fn read_i128_le(&mut self) -> Result<i128>
fn read_i128_le(&mut self) -> Result<i128>
Source§fn read_f32(&mut self, byte_order: ByteOrder) -> Result<f32>
fn read_f32(&mut self, byte_order: ByteOrder) -> Result<f32>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ByteInput for T
Source§impl<R> Leb128ReadExt for R
impl<R> Leb128ReadExt for R
Source§fn read_uleb_u8_non_strict(&mut self) -> Result<u8>
fn read_uleb_u8_non_strict(&mut self) -> Result<u8>
u8. Read moreSource§fn read_uleb_u16_non_strict(&mut self) -> Result<u16>
fn read_uleb_u16_non_strict(&mut self) -> Result<u16>
u16. Read moreSource§fn read_uleb_u16_strict(&mut self) -> Result<u16>
fn read_uleb_u16_strict(&mut self) -> Result<u16>
u16. Read moreSource§fn read_uleb_u32_non_strict(&mut self) -> Result<u32>
fn read_uleb_u32_non_strict(&mut self) -> Result<u32>
u32. Read moreSource§fn read_uleb_u32_strict(&mut self) -> Result<u32>
fn read_uleb_u32_strict(&mut self) -> Result<u32>
u32. Read moreSource§fn read_uleb_u64_non_strict(&mut self) -> Result<u64>
fn read_uleb_u64_non_strict(&mut self) -> Result<u64>
u64. Read moreSource§fn read_uleb_u64_strict(&mut self) -> Result<u64>
fn read_uleb_u64_strict(&mut self) -> Result<u64>
u64. Read moreSource§fn read_uleb_u128_non_strict(&mut self) -> Result<u128>
fn read_uleb_u128_non_strict(&mut self) -> Result<u128>
u128. Read moreSource§fn read_uleb_u128_strict(&mut self) -> Result<u128>
fn read_uleb_u128_strict(&mut self) -> Result<u128>
u128. Read moreSource§fn read_uleb_usize_non_strict(&mut self) -> Result<usize>
fn read_uleb_usize_non_strict(&mut self) -> Result<usize>
usize. Read moreSource§fn read_uleb_usize_strict(&mut self) -> Result<usize>
fn read_uleb_usize_strict(&mut self) -> Result<usize>
usize. Read moreSource§fn read_sleb_i8_non_strict(&mut self) -> Result<i8>
fn read_sleb_i8_non_strict(&mut self) -> Result<i8>
i8. Read moreSource§fn read_sleb_i16_non_strict(&mut self) -> Result<i16>
fn read_sleb_i16_non_strict(&mut self) -> Result<i16>
i16. Read moreSource§fn read_sleb_i32_non_strict(&mut self) -> Result<i32>
fn read_sleb_i32_non_strict(&mut self) -> Result<i32>
i32. Read moreSource§fn read_sleb_i64_non_strict(&mut self) -> Result<i64>
fn read_sleb_i64_non_strict(&mut self) -> Result<i64>
i64. Read moreSource§fn read_sleb_i128_non_strict(&mut self) -> Result<i128>
fn read_sleb_i128_non_strict(&mut self) -> Result<i128>
i128. Read moreSource§fn read_sleb_i128_strict(&mut self) -> Result<i128>
fn read_sleb_i128_strict(&mut self) -> Result<i128>
i128. Read moreimpl<T> SeekableByteInput for T
impl<T> SeekableInput for T
Source§impl<T> StringReadExt for T
impl<T> StringReadExt for T
Source§fn read_utf8_payload_into(
&mut self,
bytes: &mut Vec<u8>,
len: usize,
max_len: usize,
) -> Result<(), Error>
fn read_utf8_payload_into( &mut self, bytes: &mut Vec<u8>, len: usize, max_len: usize, ) -> Result<(), Error>
Reads a validated UTF-8 payload into the caller’s reusable byte buffer.
The buffer contents and error behavior follow the contract documented
on StringReadExt::read_utf8_payload_into.
§Parameters
bytes: Reusable destination buffer for the received payload.len: UTF-8 payload length in bytes.max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_utf8_payload(
&mut self,
len: usize,
max_len: usize,
) -> Result<String, Error>
fn read_utf8_payload( &mut self, len: usize, max_len: usize, ) -> Result<String, Error>
Reads and validates a UTF-8 payload whose byte length is already known.
Length limits and input-consumption behavior follow the contract
documented on StringReadExt::read_utf8_payload.
§Parameters
len: UTF-8 payload length in bytes.max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_utf8_string_uleb_usize(
&mut self,
max_len: usize,
) -> Result<String, Error>
fn read_utf8_string_uleb_usize( &mut self, max_len: usize, ) -> Result<String, Error>
Decodes a non-strict usize ULEB128 length and reads that UTF-8
payload.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_utf8_string_uleb_usize_strict(
&mut self,
max_len: usize,
) -> Result<String, Error>
fn read_utf8_string_uleb_usize_strict( &mut self, max_len: usize, ) -> Result<String, Error>
Decodes a canonical usize ULEB128 length and reads that UTF-8 payload.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_utf8_string_uleb_u64(&mut self, max_len: usize) -> Result<String, Error>
fn read_utf8_string_uleb_u64(&mut self, max_len: usize) -> Result<String, Error>
Decodes a non-strict u64 ULEB128 length and reads that UTF-8 payload.
Returns an invalid-data error if the length cannot fit in usize.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_utf8_string_uleb_u64_strict(
&mut self,
max_len: usize,
) -> Result<String, Error>
fn read_utf8_string_uleb_u64_strict( &mut self, max_len: usize, ) -> Result<String, Error>
Decodes a canonical u64 ULEB128 length and reads that UTF-8 payload.
Returns an invalid-data error for a malformed prefix or a length that
cannot fit in usize.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_string_with_u16_len(
&mut self,
byte_order: ByteOrder,
max_len: usize,
) -> Result<String, Error>
fn read_string_with_u16_len( &mut self, byte_order: ByteOrder, max_len: usize, ) -> Result<String, Error>
Reads a UTF-8 payload preceded by a u16 length in the selected byte
order.
§Parameters
byte_order: Byte order used by the length prefix.max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_string_with_u16_len_be(
&mut self,
max_len: usize,
) -> Result<String, Error>
fn read_string_with_u16_len_be( &mut self, max_len: usize, ) -> Result<String, Error>
Reads a UTF-8 payload preceded by a big-endian u16 length.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_string_with_u16_len_le(
&mut self,
max_len: usize,
) -> Result<String, Error>
fn read_string_with_u16_len_le( &mut self, max_len: usize, ) -> Result<String, Error>
Reads a UTF-8 payload preceded by a little-endian u16 length.
§Parameters
max_len: Maximum accepted UTF-8 payload length in bytes.
Source§fn read_string_with_u32_len(
&mut self,
byte_order: ByteOrder,
max_len: usize,
) -> Result<String, Error>
fn read_string_with_u32_len( &mut self, byte_order: ByteOrder, max_len: usize, ) -> Result<String, Error>
Reads a UTF-8 payload preceded by a u32 length in the selected byte
order.
§Parameters
byte_order: Byte order used by the length prefix.max_len: Maximum accepted UTF-8 payload length in bytes.
Source§impl<R> ZigZagReadExt for R
impl<R> ZigZagReadExt for R
Source§fn read_zig_zag_i8_non_strict(&mut self) -> Result<i8>
fn read_zig_zag_i8_non_strict(&mut self) -> Result<i8>
i8. Read moreSource§fn read_zig_zag_i16_non_strict(&mut self) -> Result<i16>
fn read_zig_zag_i16_non_strict(&mut self) -> Result<i16>
i16. Read moreSource§fn read_zig_zag_i32_non_strict(&mut self) -> Result<i32>
fn read_zig_zag_i32_non_strict(&mut self) -> Result<i32>
i32. Read moreSource§fn read_zig_zag_i64_non_strict(&mut self) -> Result<i64>
fn read_zig_zag_i64_non_strict(&mut self) -> Result<i64>
i64. Read moreSource§fn read_zig_zag_i128_non_strict(&mut self) -> Result<i128>
fn read_zig_zag_i128_non_strict(&mut self) -> Result<i128>
i128. Read more