[][src]Function encoding_c_mem::encoding_mem_convert_utf16_to_latin1_lossy

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

If the input is valid UTF-16 representing only Unicode code points from U+0000 to U+00FF, inclusive, converts the input into output that represents the value of each code point as the unsigned byte value of each output byte.

If the input does not fulfill the condition stated above, does something that is memory-safe without any promises about any properties of the output and will probably assert in debug builds in future versions. In particular, callers shouldn't assume the output to be the same across crate versions or CPU architectures and should not assume that non-ASCII input can't map to ASCII output.

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

The number of bytes written equals the length of the source buffer.

Panics

Panics if the destination buffer is shorter than stated above.

(Probably in future versions if debug assertions are enabled (and not fuzzing) and the input is not in the range U+0000 to U+00FF, inclusive.)

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.)