MCPcopy Create free account
hub / github.com/apache/fory / read_utf16_string

Method read_utf16_string

rust/fory-core/src/buffer.rs:989–998  ·  view source on GitHub ↗
(&mut self, len: usize)

Source from the content-addressed store, hash-verified

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

Callers 1

fory_read_dataMethod · 0.80

Calls 4

check_boundMethod · 0.80
sub_sliceMethod · 0.80
move_nextMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected