Returns a single feature_bit in hex representation, least-significant bit first. # Arguments `feature_bit`: The 0-based index of the bit to check across the bitmap.
(feature_bit: usize)
| 55 | /// * `feature_bit`: The 0-based index of the bit to check across the bitmap. |
| 56 | /// |
| 57 | pub fn feature_bit_to_hex(feature_bit: usize) -> String { |
| 58 | let byte_index = feature_bit >> 3; // Equivalent to feature_bit / 8 |
| 59 | let mask = 1 << (feature_bit & 7); // Equivalent to feature_bit % 8 |
| 60 | let mut map = vec![0u8; byte_index + 1]; |
| 61 | map[0] |= mask; // least-significant bit first ordering. |
| 62 | hex::encode(&map) |
| 63 | } |
| 64 | |
| 65 | /// Errors that can occur when unwrapping payload data |
| 66 | #[derive(Debug, Clone, PartialEq)] |