pub trait ExtractBitsFromVecU8 {
// Required methods
fn get_u8(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u8, String>;
fn get_i8(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i8, String>;
fn get_u16(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u16, String>;
fn get_i16(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i16, String>;
fn get_u32(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u32, String>;
fn get_i32(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i32, String>;
fn get_u64(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u64, String>;
fn get_i64(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i64, String>;
}Expand description
Defines a number of functions, which extract a range of bits from a Vec
Required Methods§
Sourcefn get_u8(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u8, String>
fn get_u8( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<u8, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_i8(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i8, String>
fn get_i8( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<i8, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_u16(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u16, String>
fn get_u16( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<u16, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_i16(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i16, String>
fn get_i16( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<i16, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_u32(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u32, String>
fn get_u32( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<u32, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_i32(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i32, String>
fn get_i32( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<i32, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_u64(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<u64, String>
fn get_u64( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<u64, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.
Sourcefn get_i64(
&self,
byte_offset: u32,
start: u32,
length: u32,
) -> Result<i64, String>
fn get_i64( &self, byte_offset: u32, start: u32, length: u32, ) -> Result<i64, String>
Extracts a range of bits from a Vec
Parameters:
- byte_offset (u32) the number of bytes to skip in source
- bit_offset (u32) the start position of the bits to be extracted. Zero is the most significant bit
- length (u32) the number of bits to be extracted.