(&self)
| 49 | #[inline(always)] |
| 50 | #[allow(clippy::missing_panics_doc, reason = "the method is panic-free")] |
| 51 | pub fn raw_pos(&self) -> u8 { |
| 52 | let rate_u8 = u8::try_from(RATE).expect("RATE is smaller than 256"); |
| 53 | debug_assert!(self.pos < rate_u8); |
| 54 | if self.pos < rate_u8 { |
| 55 | self.pos |
| 56 | } else { |
| 57 | // SAFETY: the type enforces that `pos` is always smaller than `RATE` |
| 58 | unsafe { core::hint::unreachable_unchecked() }; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /// Get current cursor position as `usize`. |
| 63 | #[must_use] |