diff --git a/src/utf16.rs b/src/utf16.rs index 4350108..549f974 100644 --- a/src/utf16.rs +++ b/src/utf16.rs @@ -87,7 +87,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec { /// Decode a UTF-16 code point into a unicode code point. /// /// # Parameters -/// * `utf16_cp`: [`&Vec`] - A vector of UTF-16 code points. +/// * `utf16_cp`: [`&[u16]`] - A slice of UTF-16 code points. /// * `i`: [`usize`] - The index of the byte to read. /// /// # Returns @@ -98,7 +98,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec { /// # Panics /// * If the index `i` is out of bounds. /// * If the UTF-16 code point is invalid. -fn decode_symbol(utf16_cp: &Vec, i: usize) -> Option<(u32, usize)> { +fn decode_symbol(utf16_cp: &[u16], i: usize) -> Option<(u32, usize)> { if i > utf16_cp.len() { panic!("Index out of bounds"); } diff --git a/src/utf8.rs b/src/utf8.rs index 10ae1cc..84eff6c 100644 --- a/src/utf8.rs +++ b/src/utf8.rs @@ -139,7 +139,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec { /// Read the next byte from a vector of UTF-8 code points. /// /// # Parameters -/// * `byte_vec`: [`&Vec`] - A vector of UTF-8 code points. +/// * `byte_vec`: [`&[u8]`] - A slice of UTF-8 code points. /// * `i`: [`usize`] - The index of the byte to read. /// /// # Returns @@ -148,7 +148,7 @@ fn encode_code_point(unicode_cp: u32) -> Vec { /// # Panics /// * If the index `i` is out of bounds. /// * If the byte at index `i` is not a continuation byte. -fn read_next_byte(byte_vec: &Vec, i: usize) -> u32 { +fn read_next_byte(byte_vec: &[u8], i: usize) -> u32 { if i >= byte_vec.len() { panic!("Index out of bounds"); } @@ -173,7 +173,7 @@ fn read_next_byte(byte_vec: &Vec, i: usize) -> u32 { /// Decode a UTF-8 code point into a unicode code point. /// /// # Parameters -/// * `utf8_cp`: [`&Vec`] - A vector of UTF-8 code points. +/// * `utf8_cp`: [`&[u8]`] - A slice of UTF-8 code points. /// * `i`: [`usize`] - The index of the byte to read. It should be the index of a prefix byte. /// /// # Returns @@ -185,7 +185,7 @@ fn read_next_byte(byte_vec: &Vec, i: usize) -> u32 { /// * If the index `i` is out of bounds. /// * If, after reading the first byte, the continuation bytes are not valid. /// * If the UTF-8 code point is invalid. -fn decode_symbol(utf8_cp: &Vec, i: usize) -> Option<(u32, usize)> { +fn decode_symbol(utf8_cp: &[u8], i: usize) -> Option<(u32, usize)> { if i > utf8_cp.len() { panic!("Index out of bounds"); }