(&mut self, len: usize)
| 987 | |
| 988 | #[inline(always)] |
| 989 | pub fn read_utf16_string(&mut self, len: usize) -> Result<String, Error> { |
| 990 | self.check_bound(len)?; |
| 991 | let slice = self.sub_slice(self.cursor, self.cursor + len)?; |
| 992 | let units: Vec<u16> = slice |
| 993 | .chunks_exact(2) |
| 994 | .map(|c| u16::from_le_bytes([c[0], c[1]])) |
| 995 | .collect(); |
| 996 | self.move_next(len); |
| 997 | Ok(String::from_utf16_lossy(&units)) |
| 998 | } |
| 999 | |
| 1000 | // ============ Rust-specific types (i128, u128, isize, usize) ============ |
| 1001 |
no test coverage detected