pub type DataSegment<'s> = Segment<'s, u8>;
Expand description
An alias for a segment that deals with binary data.
Aliased Type§
pub struct DataSegment<'s> { /* private fields */ }
Implementations§
Source§impl<'s> DataSegment<'s>
impl<'s> DataSegment<'s>
Sourcepub fn with_endidness(data: &'s [u8], endidness: Endidness) -> Self
pub fn with_endidness(data: &'s [u8], endidness: Endidness) -> Self
Sourcepub fn with_offset_and_endidness(
data: &'s [u8],
initial_offset: usize,
endidness: Endidness,
) -> Self
pub fn with_offset_and_endidness( data: &'s [u8], initial_offset: usize, endidness: Endidness, ) -> Self
Sourcepub fn next_bytes(&self, buf: &mut [u8]) -> Result<()>
pub fn next_bytes(&self, buf: &mut [u8]) -> Result<()>
Fills the provided buffer with the next n bytes, where n is the length of the buffer. This
then advances the Segment::current_offset
by n.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn int_at<N: Integer>(&self, offset: usize) -> Result<N>
pub fn int_at<N: Integer>(&self, offset: usize) -> Result<N>
Gets an integer of the provided type (e.g. u8
, i8
, u16
, i16
, etcetera) at the given
offset without altering the Segment::current_offset
. In most cases, you should use
methods like Segment::u8_at
instead.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn u8_at(&self, offset: usize) -> Result<u8>
pub fn u8_at(&self, offset: usize) -> Result<u8>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn u16_at(&self, offset: usize) -> Result<u16>
pub fn u16_at(&self, offset: usize) -> Result<u16>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn u32_at(&self, offset: usize) -> Result<u32>
pub fn u32_at(&self, offset: usize) -> Result<u32>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn u64_at(&self, offset: usize) -> Result<u64>
pub fn u64_at(&self, offset: usize) -> Result<u64>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn u128_at(&self, offset: usize) -> Result<u128>
pub fn u128_at(&self, offset: usize) -> Result<u128>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn i8_at(&self, offset: usize) -> Result<i8>
pub fn i8_at(&self, offset: usize) -> Result<i8>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn i16_at(&self, offset: usize) -> Result<i16>
pub fn i16_at(&self, offset: usize) -> Result<i16>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn i32_at(&self, offset: usize) -> Result<i32>
pub fn i32_at(&self, offset: usize) -> Result<i32>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn i64_at(&self, offset: usize) -> Result<i64>
pub fn i64_at(&self, offset: usize) -> Result<i64>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn i128_at(&self, offset: usize) -> Result<i128>
pub fn i128_at(&self, offset: usize) -> Result<i128>
See the documentation for Segment::int_at
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_int<N: Integer>(&self) -> Result<N>
pub fn current_int<N: Integer>(&self) -> Result<N>
Gets an integer of the provided type (e.g. u8
, i8
, u16
, i16
, etcetera) starting at
the at the Segment::current_offset
without altering it. In most cases, you should use
methods like Segment::current_u8
instead.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_u8(&self) -> Result<u8>
pub fn current_u8(&self) -> Result<u8>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_u16(&self) -> Result<u16>
pub fn current_u16(&self) -> Result<u16>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_u32(&self) -> Result<u32>
pub fn current_u32(&self) -> Result<u32>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_u64(&self) -> Result<u64>
pub fn current_u64(&self) -> Result<u64>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_u128(&self) -> Result<u128>
pub fn current_u128(&self) -> Result<u128>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_i8(&self) -> Result<i8>
pub fn current_i8(&self) -> Result<i8>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_i16(&self) -> Result<i16>
pub fn current_i16(&self) -> Result<i16>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_i32(&self) -> Result<i32>
pub fn current_i32(&self) -> Result<i32>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_i64(&self) -> Result<i64>
pub fn current_i64(&self) -> Result<i64>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn current_i128(&self) -> Result<i128>
pub fn current_i128(&self) -> Result<i128>
See the documentation for Segment::current_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_int<N: Integer>(&self) -> Result<N>
pub fn peek_int<N: Integer>(&self) -> Result<N>
Gets an integer of the provided type (e.g. u8
, i8
, u16
, i16
, etcetera) starting at
the at the Segment::current_offset
but without advancing the
Segment::current_offset
. In most
cases, you should use methods like Segment::peek_u8
instead.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_u8(&self) -> Result<u8>
pub fn peek_u8(&self) -> Result<u8>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_u16(&self) -> Result<u16>
pub fn peek_u16(&self) -> Result<u16>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_u32(&self) -> Result<u32>
pub fn peek_u32(&self) -> Result<u32>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_u64(&self) -> Result<u64>
pub fn peek_u64(&self) -> Result<u64>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_u128(&self) -> Result<u128>
pub fn peek_u128(&self) -> Result<u128>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_i8(&self) -> Result<i8>
pub fn peek_i8(&self) -> Result<i8>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_i16(&self) -> Result<i16>
pub fn peek_i16(&self) -> Result<i16>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_i32(&self) -> Result<i32>
pub fn peek_i32(&self) -> Result<i32>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_i64(&self) -> Result<i64>
pub fn peek_i64(&self) -> Result<i64>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn peek_i128(&self) -> Result<i128>
pub fn peek_i128(&self) -> Result<i128>
See the documentation for Segment::peek_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_int<N: Integer>(&self) -> Result<N>
pub fn next_int<N: Integer>(&self) -> Result<N>
Gets an integer of the provided type (e.g. u8
, i8
, u16
, i16
, etcetera) starting at
the at the Segment::current_offset
and then advances the Segment::current_offset
by
n, where n is the number of bytes required to create the requested integer type. In most
cases, you should use methods like Segment::next_u8
instead.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_u8(&self) -> Result<u8>
pub fn next_u8(&self) -> Result<u8>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_u16(&self) -> Result<u16>
pub fn next_u16(&self) -> Result<u16>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_u32(&self) -> Result<u32>
pub fn next_u32(&self) -> Result<u32>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_u64(&self) -> Result<u64>
pub fn next_u64(&self) -> Result<u64>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_u128(&self) -> Result<u128>
pub fn next_u128(&self) -> Result<u128>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_i8(&self) -> Result<i8>
pub fn next_i8(&self) -> Result<i8>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_i16(&self) -> Result<i16>
pub fn next_i16(&self) -> Result<i16>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.
Sourcepub fn next_i32(&self) -> Result<i32>
pub fn next_i32(&self) -> Result<i32>
See the documentation for Segment::next_int
.
Note: Only available if the Segment
’s I is u8
.