Type Alias DataSegment

Source
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>

Source

pub fn with_endidness(data: &'s [u8], endidness: Endidness) -> Self

Creates a new Segment using the provided endidness.

Note: Only available if the Segment’s I is u8.

Source

pub fn with_offset_and_endidness( data: &'s [u8], initial_offset: usize, endidness: Endidness, ) -> Self

Creates a new Segment using the provided endidness and initial offset.

Note: Only available if the Segment’s I is u8.

Source

pub fn endidness(&self) -> Endidness

The endidness of the Segment.

Note: Only available if the Segment’s I is u8.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn current_u8(&self) -> Result<u8>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_u16(&self) -> Result<u16>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_u32(&self) -> Result<u32>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_u64(&self) -> Result<u64>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_u128(&self) -> Result<u128>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_i8(&self) -> Result<i8>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_i16(&self) -> Result<i16>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_i32(&self) -> Result<i32>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_i64(&self) -> Result<i64>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn current_i128(&self) -> Result<i128>

See the documentation for Segment::current_int.

Note: Only available if the Segment’s I is u8.

Source

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.

Source

pub fn peek_u8(&self) -> Result<u8>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_u16(&self) -> Result<u16>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_u32(&self) -> Result<u32>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_u64(&self) -> Result<u64>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_u128(&self) -> Result<u128>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_i8(&self) -> Result<i8>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_i16(&self) -> Result<i16>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_i32(&self) -> Result<i32>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_i64(&self) -> Result<i64>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn peek_i128(&self) -> Result<i128>

See the documentation for Segment::peek_int.

Note: Only available if the Segment’s I is u8.

Source

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.

Source

pub fn next_u8(&self) -> Result<u8>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_u16(&self) -> Result<u16>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_u32(&self) -> Result<u32>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_u64(&self) -> Result<u64>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_u128(&self) -> Result<u128>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_i8(&self) -> Result<i8>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_i16(&self) -> Result<i16>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_i32(&self) -> Result<i32>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_i64(&self) -> Result<i64>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.

Source

pub fn next_i128(&self) -> Result<i128>

See the documentation for Segment::next_int.

Note: Only available if the Segment’s I is u8.