pub fn parse_bits(bits: &str) -> Result<u32, ParseIntError> {
    // This will read the value in as big endian.
    let parsed = u32::from_str_radix(bits, 16);
    let parsed = match parsed {
        Ok(num) => num,
        Err(error) => return Result::Err(error),
    };
    // We assume bits was passed in as little endian, so swap to get the actual value.
    parsed.swap_bytes();
    return Result::Ok(parsed);
}
// bits is a u32 as a hex string in little endian format.
bits is a u32 as a hex string in little endian format.
bits is a u32 as a hex string in little endian format .
pub fn parse_bits(bits: &str) -> Result<u32, ParseIntError> {
    // This will read the value in as big endian.
    let parsed = u32::from_str_radix(bits, 16);
    let parsed = match parsed {
        Ok(num) => num,
        Err(error) => return Result::Err(error),
    };
    // We assume bits was passed in as little endian, so swap to get the actual value.
    parsed.swap_bytes();
    return Result::Ok(parsed);
}
pub fn parse_bits ( bits : & str ) -> Result < u32 , ParseIntError > { // This will read the value in as big endian. let parsed = u32 :: from_str_radix ( bits , 16 ) ; let parsed = match parsed { Ok ( num ) => num , Err ( error ) => return Result :: Err ( error ) , } ; // We assume bits was passed in as little endian, so swap to get the actual value. parsed . swap_bytes ( ) ; return Result :: Ok ( parsed ) ; }
bits is a u32 as a hex string in little endian format.
bits is a u32 as a hex string in little endian format .
bits
&str
bits
&str