Function pelite::util::wstrn [−][src]
pub fn wstrn(buf: &[u16]) -> &[u16]
Reads an optionally nul-terminated wide char string from buffer.
Returns the slice split before the nul word and the whole slice if no nul word is found.
Analog to the wcsn*
family of C string functions.
Examples
use pelite::util::wstrn; let buf: [u16; 8] = [83, 84, 82, 73, 78, 71, 0, 0]; assert_eq!(wstrn(&buf), &[83, 84, 82, 73, 78, 71]); let buf: [u16; 4] = [70, 79, 85, 82]; assert_eq!(wstrn(&buf), &[70, 79, 85, 82]);