encoding_mem_convert_latin1_to_utf8_partial

Function encoding_mem_convert_latin1_to_utf8_partial 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn encoding_mem_convert_latin1_to_utf8_partial( src: *const u8, src_len: *mut usize, dst: *mut u8, dst_len: *mut usize, )
Expand description

Converts bytes whose unsigned value is interpreted as Unicode code point (i.e. U+0000 to U+00FF, inclusive) to UTF-8 with potentially insufficient output space.

Writes the number of code units read into *src_len and the number of bytes written into *dst_len.

If the output isn’t large enough, not all input is consumed.

§Safety

If you want to convert into a &mut str, use encoding_mem_convert_latin1_to_str_partial() instead of using this function together with the unsafe method as_bytes_mut() on &mut str.

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