pub struct BytesView { /* private fields */ }Expand description
A view over a sequence of immutable bytes.
Only the contents are immutable - the view itself can be mutated in terms of progressively marking the byte sequence as consumed until the view becomes empty.
§Creating a BytesView
Instances can be created in different ways:
- Use a
BytesBufto build the byte sequence piece by piece, consuming the buffered data as a newBytesViewwhen finished. - Clone an existing
BytesViewwithclone(). - Take a range of bytes from an existing
BytesViewviarange(). - Combine multiple
BytesViewinstances into one viafrom_views(),concat()orappend(). - Copy data from a
&[u8]usingcopied_from_slice().
Some of these methods may require you to first obtain access to a memory provider.
§Memory layout
A byte sequence represented by bytesbuf types may consist of any number
of separate byte slices, each of which contains one or more bytes of data.
There is no upper or lower bound on the length of each slice of bytes. At one extreme, a byte sequence may be entirely represented by a single slice of bytes. At the opposite extreme, it is legal for each byte to be represented by a separate non-consecutive slice.
Examples of legal memory layouts for the byte sequence b'Hello':
['H', 'e', 'l', 'l', 'o']['H', 'e'], ['l', 'l', 'o']['H'], ['e'], ['l'], ['l'], ['o']
Code using these APIs is required to work with any memory layout, as there are no guarantees on which layout will be used for which byte sequences.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"Hello!", &memory);
// Read bytes one at a time until the view is empty.
while !view.is_empty() {
let byte = view.get_byte();
println!("Read byte: {byte}");
}
assert!(view.is_empty());Implementations§
Source§impl BytesView
impl BytesView
Sourcepub fn to_bytes(&self) -> Bytes
Available on crate features bytes-compat only.
pub fn to_bytes(&self) -> Bytes
bytes-compat only.Returns a bytes::Bytes that contains the same byte sequence.
§Example
use bytes::Buf;
use bytesbuf::BytesView;
let view = BytesView::copied_from_slice(b"\x12\x34\x56\x78", &memory);
let mut bytes = view.to_bytes();
// Consume the data using the bytes crate's Buf trait.
assert_eq!(bytes.get_u16(), 0x1234);
assert_eq!(bytes.get_u16(), 0x5678);
assert!(!bytes.has_remaining());§Performance
This operation is zero-copy if the sequence is backed by a single consecutive slice of memory capacity.
If the sequence is backed by multiple slices of memory capacity, the data will be copied
to a new Bytes instance backed by new memory capacity from the Rust global allocator.
You generally want to avoid this conversion in performance-sensitive code.
This conversion always requires a small dynamic memory allocation for metadata, so avoiding conversions is valuable even if zero-copy.
§Why is this not .into()?
We do not allow conversion via .into() because the conversion is not guaranteed to be
a cheap operation and may involve data copying. The .to_bytes() function must always
be explicitly called to make the conversion more obvious and easier to catch in reviews.
Source§impl BytesView
impl BytesView
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a view over a zero-sized byte sequence.
Use a BytesBuf to create a view over some actual data.
Sourcepub fn from_views<I>(views: I) -> Self
pub fn from_views<I>(views: I) -> Self
Concatenates a number of existing byte sequences, yielding a combined view.
§Example
use bytesbuf::BytesView;
let header = BytesView::copied_from_slice(b"HTTP/1.1 ", &memory);
let status = BytesView::copied_from_slice(b"200 ", &memory);
let message = BytesView::copied_from_slice(b"OK", &memory);
let response_line = BytesView::from_views([header, status, message]);
assert_eq!(response_line.len(), 15);
assert_eq!(response_line, b"HTTP/1.1 200 OK");§Panics
Panics if the resulting view would be larger than usize::MAX bytes.
Sourcepub fn copied_from_slice(bytes: &[u8], memory: &impl Memory) -> Self
pub fn copied_from_slice(bytes: &[u8], memory: &impl Memory) -> Self
Creates a BytesView by copying the contents of a &[u8].
§Example
use bytesbuf::BytesView;
const CONTENT_TYPE_KEY: &[u8] = b"Content-Type: ";
let header_key = BytesView::copied_from_slice(CONTENT_TYPE_KEY, &tcp_connection.memory());
assert_eq!(header_key.len(), 14);§Reusing without copying
There is intentionally no mechanism in the bytesbuf crate to reference an existing
&[u8] without copying the contents, even if it has a 'static lifetime.
The purpose of this limitation is to discourage accidentally involving arbitrary
memory in high-performance I/O workflows. For efficient I/O processing, data must
be stored in memory configured according to the needs of the consuming I/O endpoint,
which is not the case for an arbitrary &'static [u8].
To reuse memory allocations, you need to reuse BytesView instances themselves.
See the bb_reuse.rs example in the bytesbuf crate for a detailed example.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of bytes exposed through the view.
Consuming bytes from the view reduces its length.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"Hello", &memory);
assert_eq!(view.len(), 5);
_ = view.get_byte();
assert_eq!(view.len(), 4);
_ = view.get_num_le::<u16>();
assert_eq!(view.len(), 2);Sourcepub fn extend_lifetime(&self) -> MemoryGuard
pub fn extend_lifetime(&self) -> MemoryGuard
Extends the lifetime of the memory capacity backing this view.
This can be useful when unsafe code is used to reference the contents of a BytesView and it
is possible to reach a condition where the BytesView itself no longer exists, even though
the contents are referenced (e.g. because the remaining references are in non-Rust code).
Sourcepub fn range<R>(&self, range: R) -> Selfwhere
R: RangeBounds<usize>,
pub fn range<R>(&self, range: R) -> Selfwhere
R: RangeBounds<usize>,
Returns a range of the byte sequence.
The bounds logic only considers data currently present in the view. Any data already consumed is not considered part of the view.
§Example
use bytesbuf::BytesView;
let view = BytesView::copied_from_slice(b"Hello, world!", &memory);
assert_eq!(view.range(0..5), b"Hello");
assert_eq!(view.range(7..), b"world!");
assert_eq!(view.range(..5), b"Hello");
assert_eq!(view.range(..), b"Hello, world!");§Panics
Panics if the provided range is outside the bounds of the view.
Sourcepub fn range_checked<R>(&self, range: R) -> Option<Self>where
R: RangeBounds<usize>,
pub fn range_checked<R>(&self, range: R) -> Option<Self>where
R: RangeBounds<usize>,
Returns a range of the byte sequence or None if out of bounds.
The bounds logic only considers data currently present in the view. Any data already consumed is not considered part of the view.
Sourcepub fn consume_all_slices<F>(&mut self, f: F)
pub fn consume_all_slices<F>(&mut self, f: F)
Executes a function f on each slice, consuming them all.
The slices that make up the view are iterated in order,
providing each to f. The view becomes empty after this.
§Example
use bytesbuf::BytesView;
// Create a multi-slice view by concatenating independent views.
let mut view = BytesView::from_views([part1, part2, part3]);
view.consume_all_slices(|slice| {
println!("Slice of {} bytes: {:?}", slice.len(), slice);
});
assert!(view.is_empty());Sourcepub fn first_slice(&self) -> &[u8] ⓘ
pub fn first_slice(&self) -> &[u8] ⓘ
References the first slice of bytes in the byte sequence.
Returns an empty slice if the view is over a zero-sized byte sequence.
§Memory layout
A byte sequence represented by bytesbuf types may consist of any number
of separate byte slices, each of which contains one or more bytes of data.
There is no upper or lower bound on the length of each slice of bytes. At one extreme, a byte sequence may be entirely represented by a single slice of bytes. At the opposite extreme, it is legal for each byte to be represented by a separate non-consecutive slice.
Examples of legal memory layouts for the byte sequence b'Hello':
['H', 'e', 'l', 'l', 'o']['H', 'e'], ['l', 'l', 'o']['H'], ['e'], ['l'], ['l'], ['o']
Code using these APIs is required to work with any memory layout, as there are no guarantees on which layout will be used for which byte sequences.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"0123456789ABCDEF", &memory);
// Read the first 10 bytes without assuming the length of first_slice().
let mut ten_bytes = Vec::with_capacity(10);
while ten_bytes.len() < 10 {
let slice = view.first_slice();
let bytes_to_take = slice.len().min(10 - ten_bytes.len());
ten_bytes.extend_from_slice(&slice[..bytes_to_take]);
view.advance(bytes_to_take);
}
assert_eq!(ten_bytes, b"0123456789");Sourcepub fn io_slices<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize
pub fn io_slices<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize
Fills an array with IoSlices representing this view.
Returns the number of elements written into dst. If there is not enough space in dst
to represent the entire view, only as many slices as fit will be written.
See also slices() for a version that fills an array of regular slices instead of IoSlices.
§Memory layout
A byte sequence represented by bytesbuf types may consist of any number
of separate byte slices, each of which contains one or more bytes of data.
There is no upper or lower bound on the length of each slice of bytes. At one extreme, a byte sequence may be entirely represented by a single slice of bytes. At the opposite extreme, it is legal for each byte to be represented by a separate non-consecutive slice.
Examples of legal memory layouts for the byte sequence b'Hello':
['H', 'e', 'l', 'l', 'o']['H', 'e'], ['l', 'l', 'o']['H'], ['e'], ['l'], ['l'], ['o']
Code using these APIs is required to work with any memory layout, as there are no guarantees on which layout will be used for which byte sequences.
§Example
use std::io::IoSlice;
use bytesbuf::BytesView;
let view = BytesView::from_views([part1, part2]);
let mut io_slices = [IoSlice::new(&[]); 4];
let count = view.io_slices(&mut io_slices);
for i in 0..count {
println!(
"IoSlice {i}: {} bytes at {:p}",
io_slices[i].len(),
io_slices[i].as_ptr()
);
}Sourcepub fn slices<'a>(&'a self, dst: &mut [&'a [u8]]) -> usize
pub fn slices<'a>(&'a self, dst: &mut [&'a [u8]]) -> usize
Fills an array with byte slices representing this view.
Returns the number of elements written into dst. If there is not enough space in dst
to represent the entire view, only as many slices as fit will be written.
See also io_slices() for a version that fills an array of IoSlices instead of regular byte slices.
§Memory layout
A byte sequence represented by bytesbuf types may consist of any number
of separate byte slices, each of which contains one or more bytes of data.
There is no upper or lower bound on the length of each slice of bytes. At one extreme, a byte sequence may be entirely represented by a single slice of bytes. At the opposite extreme, it is legal for each byte to be represented by a separate non-consecutive slice.
Examples of legal memory layouts for the byte sequence b'Hello':
['H', 'e', 'l', 'l', 'o']['H', 'e'], ['l', 'l', 'o']['H'], ['e'], ['l'], ['l'], ['o']
Code using these APIs is required to work with any memory layout, as there are no guarantees on which layout will be used for which byte sequences.
§Example
use bytesbuf::BytesView;
let view = BytesView::from_views([part1, part2]);
let mut slices: [&[u8]; 4] = [&[]; 4];
let count = view.slices(&mut slices);
for i in 0..count {
println!(
"Slice {i}: {} bytes at {:p}",
slices[i].len(),
slices[i].as_ptr()
);
}Sourcepub fn first_slice_meta(&self) -> Option<&dyn Any>
pub fn first_slice_meta(&self) -> Option<&dyn Any>
Inspects the metadata of the first_slice().
None if there is no metadata associated with the first slice or
if the view is over a zero-sized byte sequence.
§Example
use bytesbuf::BytesView;
let view = BytesView::copied_from_slice(b"Hello", &memory);
let is_page_aligned = view
.first_slice_meta()
.is_some_and(|meta| meta.is::<PageAlignedMemory>());
println!("First slice is page-aligned: {is_page_aligned}");See the stand-alone example bb_optimal_path.rs in the bytesbuf crate for
a more detailed example of how to make use of the slice metadata.
Sourcepub fn iter_slice_metas(&self) -> BytesViewSliceMetas<'_> ⓘ
pub fn iter_slice_metas(&self) -> BytesViewSliceMetas<'_> ⓘ
Iterates over the metadata of all the slices that make up the view.
Each slice iterated over is a slice that would be returned by first_slice()
at some point during the complete consumption of the data covered by a BytesView.
You may wish to iterate over the metadata to determine in advance which implementation strategy to use for a function, depending on what the metadata indicates about the configuration of the memory blocks backing the byte sequence.
§Example
use bytesbuf::BytesView;
let view = BytesView::copied_from_slice(b"Hello", &memory);
let all_page_aligned = view
.iter_slice_metas()
.all(|meta| meta.is_some_and(|m| m.is::<PageAlignedMemory>()));
if all_page_aligned {
println!("All slices are page-aligned, using optimized I/O path.");
}See the stand-alone example bb_optimal_path.rs in the bytesbuf crate for
a more detailed example of how to make use of the slice metadata.
Sourcepub fn advance(&mut self, count: usize)
pub fn advance(&mut self, count: usize)
Removes the first count bytes from the front of the view.
The consumed bytes are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"0123456789ABCDEF", &memory);
// Read the first 10 bytes without assuming the length of first_slice().
let mut ten_bytes = Vec::with_capacity(10);
while ten_bytes.len() < 10 {
let slice = view.first_slice();
let bytes_to_take = slice.len().min(10 - ten_bytes.len());
ten_bytes.extend_from_slice(&slice[..bytes_to_take]);
view.advance(bytes_to_take);
}
assert_eq!(ten_bytes, b"0123456789");§Panics
Panics if count is greater than the number of bytes remaining.
Sourcepub fn append(&mut self, other: Self)
pub fn append(&mut self, other: Self)
Appends another view to the end of this one.
This is a zero-copy operation, reusing the memory capacity of the other view.
§Example
use bytesbuf::BytesView;
let mut greeting = BytesView::copied_from_slice(b"Hello, ", &memory);
let name = BytesView::copied_from_slice(b"world!", &memory);
greeting.append(name);
assert_eq!(greeting, b"Hello, world!");§Panics
Panics if the resulting view would be larger than usize::MAX bytes.
Sourcepub fn concat(&self, other: Self) -> Self
pub fn concat(&self, other: Self) -> Self
Returns a new view that concatenates this view with another.
This is a zero-copy operation, reusing the memory capacity of the other view.
§Example
use bytesbuf::BytesView;
let greeting = BytesView::copied_from_slice(b"Hello, ", &memory);
let name = BytesView::copied_from_slice(b"world!", &memory);
let message = greeting.concat(name);
// Original view is unchanged.
assert_eq!(greeting, b"Hello, ");
// New view contains the concatenation.
assert_eq!(message, b"Hello, world!");§Panics
Panics if the resulting view would be larger than usize::MAX bytes.
Sourcepub fn as_read(&mut self) -> impl Read
pub fn as_read(&mut self) -> impl Read
Exposes the instance through the Read trait.
§Example
use std::io::Read;
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"Hello, world!", &memory);
let mut reader = view.as_read();
let mut buffer = [0u8; 5];
let bytes_read = reader.read(&mut buffer)?;
assert_eq!(bytes_read, 5);
assert_eq!(&buffer, b"Hello");Source§impl BytesView
impl BytesView
Sourcepub fn get_byte(&mut self) -> u8
pub fn get_byte(&mut self) -> u8
Consumes a u8 from the byte sequence.
The consumed byte is dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"ABC", &memory);
assert_eq!(view.get_byte(), b'A');
assert_eq!(view.get_byte(), b'B');
assert_eq!(view.get_byte(), b'C');
assert!(view.is_empty());§Panics
Panics if the view does not cover enough bytes of data.
Sourcepub fn copy_to_slice(&mut self, dst: &mut [u8])
pub fn copy_to_slice(&mut self, dst: &mut [u8])
Transfers bytes into an initialized slice.
The copied bytes are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"Hello, world!", &memory);
let mut buffer = [0u8; 5];
view.copy_to_slice(&mut buffer);
assert_eq!(&buffer, b"Hello");
assert_eq!(view.len(), 8); // ", world!" remains§Panics
Panics if the destination is larger than the view.
Sourcepub fn copy_to_uninit_slice(&mut self, dst: &mut [MaybeUninit<u8>])
pub fn copy_to_uninit_slice(&mut self, dst: &mut [MaybeUninit<u8>])
Transfers bytes into a potentially uninitialized slice.
The copied bytes are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use std::mem::MaybeUninit;
use bytesbuf::BytesView;
let mut view = BytesView::copied_from_slice(b"Hello", &memory);
let mut buffer: [MaybeUninit<u8>; 5] = [const { MaybeUninit::uninit() }; 5];
view.copy_to_uninit_slice(&mut buffer);
// SAFETY: The buffer has been fully initialized by copy_to_uninit_slice.
let buffer: [u8; 5] = unsafe { std::mem::transmute(buffer) };
assert_eq!(&buffer, b"Hello");§Panics
Panics if the destination is larger than the view.
Sourcepub fn get_num_le<T: FromBytes>(&mut self) -> T
pub fn get_num_le<T: FromBytes>(&mut self) -> T
Consumes a number of type T in little-endian representation.
The bytes of the T are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
// Little-endian: least significant byte first.
let data: &[u8] = &[
0x34, 0x12, // u16: 0x1234
0x78, 0x56, 0x34, 0x12, // u32: 0x12345678
];
let mut view = BytesView::copied_from_slice(data, &memory);
assert_eq!(view.get_num_le::<u16>(), 0x1234);
assert_eq!(view.get_num_le::<u32>(), 0x12345678);
assert!(view.is_empty());§Panics
Panics if the view does not cover enough bytes of data.
Sourcepub fn get_num_be<T: FromBytes>(&mut self) -> T
pub fn get_num_be<T: FromBytes>(&mut self) -> T
Consumes a number of type T in big-endian representation.
The bytes of the T are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
// Big-endian: most significant byte first.
let data: &[u8] = &[
0x12, 0x34, 0x56, 0x78, // u32: 0x12345678
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, // u64: 0x0123456789ABCDEF
];
let mut view = BytesView::copied_from_slice(data, &memory);
assert_eq!(view.get_num_be::<u32>(), 0x12345678);
assert_eq!(view.get_num_be::<u64>(), 0x0123456789ABCDEF);
assert!(view.is_empty());§Panics
Panics if the view does not cover enough bytes of data.
Sourcepub fn get_num_ne<T: FromBytes>(&mut self) -> T
pub fn get_num_ne<T: FromBytes>(&mut self) -> T
Consumes a number of type T in native-endian representation.
The bytes of the T are dropped from the view, moving any remaining bytes to the front.
If permitted by memory layout considerations and reference counts, the memory capacity backing the dropped bytes is released back to the memory provider.
§Example
use bytesbuf::BytesView;
// Native-endian: byte order matches the platform.
let value1: u16 = 0x1234;
let value2: u64 = 0x0123456789ABCDEF;
let mut data = Vec::new();
data.extend_from_slice(&value1.to_ne_bytes());
data.extend_from_slice(&value2.to_ne_bytes());
let mut view = BytesView::copied_from_slice(&data, &memory);
assert_eq!(view.get_num_ne::<u16>(), 0x1234);
assert_eq!(view.get_num_ne::<u64>(), 0x0123456789ABCDEF);
assert!(view.is_empty());§Panics
Panics if the view does not cover enough bytes of data.
Trait Implementations§
Source§impl Buf for BytesView
Available on crate features bytes-compat only.
impl Buf for BytesView
bytes-compat only.Source§fn remaining(&self) -> usize
fn remaining(&self) -> usize
Source§fn chunk(&self) -> &[u8] ⓘ
fn chunk(&self) -> &[u8] ⓘ
Buf::remaining(). Note that this can return a shorter slice (this
allows non-continuous internal representation). Read moreSource§fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize
fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize
std only.Source§fn has_remaining(&self) -> bool
fn has_remaining(&self) -> bool
Source§fn copy_to_slice(&mut self, dst: &mut [u8])
fn copy_to_slice(&mut self, dst: &mut [u8])
Source§fn get_u16(&mut self) -> u16
fn get_u16(&mut self) -> u16
self in big-endian byte order. Read moreSource§fn get_u16_le(&mut self) -> u16
fn get_u16_le(&mut self) -> u16
self in little-endian byte order. Read moreSource§fn get_u16_ne(&mut self) -> u16
fn get_u16_ne(&mut self) -> u16
self in native-endian byte order. Read moreSource§fn get_i16(&mut self) -> i16
fn get_i16(&mut self) -> i16
self in big-endian byte order. Read moreSource§fn get_i16_le(&mut self) -> i16
fn get_i16_le(&mut self) -> i16
self in little-endian byte order. Read moreSource§fn get_i16_ne(&mut self) -> i16
fn get_i16_ne(&mut self) -> i16
self in native-endian byte order. Read moreSource§fn get_u32(&mut self) -> u32
fn get_u32(&mut self) -> u32
self in the big-endian byte order. Read moreSource§fn get_u32_le(&mut self) -> u32
fn get_u32_le(&mut self) -> u32
self in the little-endian byte order. Read moreSource§fn get_u32_ne(&mut self) -> u32
fn get_u32_ne(&mut self) -> u32
self in native-endian byte order. Read moreSource§fn get_i32(&mut self) -> i32
fn get_i32(&mut self) -> i32
self in big-endian byte order. Read moreSource§fn get_i32_le(&mut self) -> i32
fn get_i32_le(&mut self) -> i32
self in little-endian byte order. Read moreSource§fn get_i32_ne(&mut self) -> i32
fn get_i32_ne(&mut self) -> i32
self in native-endian byte order. Read moreSource§fn get_u64(&mut self) -> u64
fn get_u64(&mut self) -> u64
self in big-endian byte order. Read moreSource§fn get_u64_le(&mut self) -> u64
fn get_u64_le(&mut self) -> u64
self in little-endian byte order. Read moreSource§fn get_u64_ne(&mut self) -> u64
fn get_u64_ne(&mut self) -> u64
self in native-endian byte order. Read moreSource§fn get_i64(&mut self) -> i64
fn get_i64(&mut self) -> i64
self in big-endian byte order. Read moreSource§fn get_i64_le(&mut self) -> i64
fn get_i64_le(&mut self) -> i64
self in little-endian byte order. Read moreSource§fn get_i64_ne(&mut self) -> i64
fn get_i64_ne(&mut self) -> i64
self in native-endian byte order. Read moreSource§fn get_u128(&mut self) -> u128
fn get_u128(&mut self) -> u128
self in big-endian byte order. Read moreSource§fn get_u128_le(&mut self) -> u128
fn get_u128_le(&mut self) -> u128
self in little-endian byte order. Read moreSource§fn get_u128_ne(&mut self) -> u128
fn get_u128_ne(&mut self) -> u128
self in native-endian byte order. Read moreSource§fn get_i128(&mut self) -> i128
fn get_i128(&mut self) -> i128
self in big-endian byte order. Read moreSource§fn get_i128_le(&mut self) -> i128
fn get_i128_le(&mut self) -> i128
self in little-endian byte order. Read moreSource§fn get_i128_ne(&mut self) -> i128
fn get_i128_ne(&mut self) -> i128
self in native-endian byte order. Read moreSource§fn get_uint(&mut self, nbytes: usize) -> u64
fn get_uint(&mut self, nbytes: usize) -> u64
self in big-endian byte order. Read moreSource§fn get_uint_le(&mut self, nbytes: usize) -> u64
fn get_uint_le(&mut self, nbytes: usize) -> u64
self in little-endian byte order. Read moreSource§fn get_uint_ne(&mut self, nbytes: usize) -> u64
fn get_uint_ne(&mut self, nbytes: usize) -> u64
self in native-endian byte order. Read moreSource§fn get_int(&mut self, nbytes: usize) -> i64
fn get_int(&mut self, nbytes: usize) -> i64
self in big-endian byte order. Read moreSource§fn get_int_le(&mut self, nbytes: usize) -> i64
fn get_int_le(&mut self, nbytes: usize) -> i64
self in little-endian byte order. Read moreSource§fn get_int_ne(&mut self, nbytes: usize) -> i64
fn get_int_ne(&mut self, nbytes: usize) -> i64
self in native-endian byte order. Read moreSource§fn get_f32(&mut self) -> f32
fn get_f32(&mut self) -> f32
self in big-endian byte order. Read moreSource§fn get_f32_le(&mut self) -> f32
fn get_f32_le(&mut self) -> f32
self in little-endian byte order. Read moreSource§fn get_f32_ne(&mut self) -> f32
fn get_f32_ne(&mut self) -> f32
self in native-endian byte order. Read moreSource§fn get_f64(&mut self) -> f64
fn get_f64(&mut self) -> f64
self in big-endian byte order. Read moreSource§fn get_f64_le(&mut self) -> f64
fn get_f64_le(&mut self) -> f64
self in little-endian byte order. Read moreSource§fn get_f64_ne(&mut self) -> f64
fn get_f64_ne(&mut self) -> f64
self in native-endian byte order. Read moreSource§fn try_copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), TryGetError>
fn try_copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), TryGetError>
Source§fn try_get_u8(&mut self) -> Result<u8, TryGetError>
fn try_get_u8(&mut self) -> Result<u8, TryGetError>
self. Read moreSource§fn try_get_i8(&mut self) -> Result<i8, TryGetError>
fn try_get_i8(&mut self) -> Result<i8, TryGetError>
self. Read moreSource§fn try_get_u16(&mut self) -> Result<u16, TryGetError>
fn try_get_u16(&mut self) -> Result<u16, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_u16_le(&mut self) -> Result<u16, TryGetError>
fn try_get_u16_le(&mut self) -> Result<u16, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_u16_ne(&mut self) -> Result<u16, TryGetError>
fn try_get_u16_ne(&mut self) -> Result<u16, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_i16(&mut self) -> Result<i16, TryGetError>
fn try_get_i16(&mut self) -> Result<i16, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_i16_le(&mut self) -> Result<i16, TryGetError>
fn try_get_i16_le(&mut self) -> Result<i16, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_i16_ne(&mut self) -> Result<i16, TryGetError>
fn try_get_i16_ne(&mut self) -> Result<i16, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_u32(&mut self) -> Result<u32, TryGetError>
fn try_get_u32(&mut self) -> Result<u32, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_u32_le(&mut self) -> Result<u32, TryGetError>
fn try_get_u32_le(&mut self) -> Result<u32, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_u32_ne(&mut self) -> Result<u32, TryGetError>
fn try_get_u32_ne(&mut self) -> Result<u32, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_i32(&mut self) -> Result<i32, TryGetError>
fn try_get_i32(&mut self) -> Result<i32, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_i32_le(&mut self) -> Result<i32, TryGetError>
fn try_get_i32_le(&mut self) -> Result<i32, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_i32_ne(&mut self) -> Result<i32, TryGetError>
fn try_get_i32_ne(&mut self) -> Result<i32, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_u64(&mut self) -> Result<u64, TryGetError>
fn try_get_u64(&mut self) -> Result<u64, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_u64_le(&mut self) -> Result<u64, TryGetError>
fn try_get_u64_le(&mut self) -> Result<u64, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_u64_ne(&mut self) -> Result<u64, TryGetError>
fn try_get_u64_ne(&mut self) -> Result<u64, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_i64(&mut self) -> Result<i64, TryGetError>
fn try_get_i64(&mut self) -> Result<i64, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_i64_le(&mut self) -> Result<i64, TryGetError>
fn try_get_i64_le(&mut self) -> Result<i64, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_i64_ne(&mut self) -> Result<i64, TryGetError>
fn try_get_i64_ne(&mut self) -> Result<i64, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_u128(&mut self) -> Result<u128, TryGetError>
fn try_get_u128(&mut self) -> Result<u128, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_u128_le(&mut self) -> Result<u128, TryGetError>
fn try_get_u128_le(&mut self) -> Result<u128, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_u128_ne(&mut self) -> Result<u128, TryGetError>
fn try_get_u128_ne(&mut self) -> Result<u128, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_i128(&mut self) -> Result<i128, TryGetError>
fn try_get_i128(&mut self) -> Result<i128, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_i128_le(&mut self) -> Result<i128, TryGetError>
fn try_get_i128_le(&mut self) -> Result<i128, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_i128_ne(&mut self) -> Result<i128, TryGetError>
fn try_get_i128_ne(&mut self) -> Result<i128, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_uint(&mut self, nbytes: usize) -> Result<u64, TryGetError>
fn try_get_uint(&mut self, nbytes: usize) -> Result<u64, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_uint_le(&mut self, nbytes: usize) -> Result<u64, TryGetError>
fn try_get_uint_le(&mut self, nbytes: usize) -> Result<u64, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_uint_ne(&mut self, nbytes: usize) -> Result<u64, TryGetError>
fn try_get_uint_ne(&mut self, nbytes: usize) -> Result<u64, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_int(&mut self, nbytes: usize) -> Result<i64, TryGetError>
fn try_get_int(&mut self, nbytes: usize) -> Result<i64, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_int_le(&mut self, nbytes: usize) -> Result<i64, TryGetError>
fn try_get_int_le(&mut self, nbytes: usize) -> Result<i64, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_int_ne(&mut self, nbytes: usize) -> Result<i64, TryGetError>
fn try_get_int_ne(&mut self, nbytes: usize) -> Result<i64, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_f32(&mut self) -> Result<f32, TryGetError>
fn try_get_f32(&mut self) -> Result<f32, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_f32_le(&mut self) -> Result<f32, TryGetError>
fn try_get_f32_le(&mut self) -> Result<f32, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_f32_ne(&mut self) -> Result<f32, TryGetError>
fn try_get_f32_ne(&mut self) -> Result<f32, TryGetError>
self in native-endian byte order. Read moreSource§fn try_get_f64(&mut self) -> Result<f64, TryGetError>
fn try_get_f64(&mut self) -> Result<f64, TryGetError>
self in big-endian byte order. Read moreSource§fn try_get_f64_le(&mut self) -> Result<f64, TryGetError>
fn try_get_f64_le(&mut self) -> Result<f64, TryGetError>
self in little-endian byte order. Read moreSource§fn try_get_f64_ne(&mut self) -> Result<f64, TryGetError>
fn try_get_f64_ne(&mut self) -> Result<f64, TryGetError>
self in native-endian byte order. Read more