Function convert_utf8_to_utf16le_with_errors

Source
pub unsafe fn convert_utf8_to_utf16le_with_errors(
    src: *const u8,
    len: usize,
    dst: *mut u16,
) -> Result
Expand description

Convert possibly broken UTF-8 string into UTF-16LE string.

During the conversion also validation of the input string is done. This function is suitable to work with inputs from untrusted sources.

ยงSafety

  • src and dst must be non-null and properly aligned.
  • src must be valid for reads of len * size_of::<u8>() bytes
  • dst must be valid for writes of count * size_of::<u16>() bytes, where the count is the number of code units (u16) after successful conversion.
  • The memory regions of src and dst must not overlap.