[][src]Function encoding_c_mem::encoding_mem_convert_utf8_to_utf16_without_replacement

#[no_mangle]
pub unsafe extern "C" fn encoding_mem_convert_utf8_to_utf16_without_replacement(
    src: *const u8,
    src_len: usize,
    dst: *mut u16,
    dst_len: usize
) -> usize

Converts potentially-invalid UTF-8 to valid UTF-16 signaling on error.

The length of the destination buffer must be at least the length of the source buffer.

Returns the number of u16s written or SIZE_MAX if the input was invalid.

When the input was invalid, some output may have been written.

Panics

Panics if the destination buffer is shorter than stated above.

Undefined behavior

UB ensues if src and src_len don't designate a valid memory block, if src is NULL, if dst and dst_len don't designate a valid memory block, if dst is NULL or if the two memory blocks overlap. (If src_len is 0, src may be bogus but still has to be non-NULL and aligned. Likewise for dst and dst_len.)