[][src]Function stringio::partial_from_utf8

pub fn partial_from_utf8(buf: &[u8]) -> Result<(&str, &[u8]), Utf8Error>

Convert a (possibly truncated) byte array to a str and a partial code point.

Attempt to convert a byte slice to a string, in a context where the bytes are valid UTF-8 that was potentially cut off halfway through. If successful, the function will return the longest UTF-8 string possible, as well as the suffix of the bytes which are a partial UTF-8 code point. If any invalid bytes are encountered, return the Utf8Error.