# Function encoding_rs::mem::convert_utf8_to_latin1_lossy [−] [src]

    pub fn convert_utf8_to_latin1_lossy(src: &[u8], dst: &mut [u8]) -> usize

If the input is valid UTF-8 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, this function panics if debug assertions are enabled (and fuzzing isn’t) and otherwise does something that is memory-safe without any promises about any properties of the output. 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.

Returns the number of bytes written.

# Panics

Panics if the destination buffer is shorter than stated above.

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