[][src]Function stringio::partial_from_utf8_mut

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

Converte a (possible trucated) mutable UTD-8 byte array to a str and a partial code point.

THis function is the same as partial_from_utf8, but for mutable slices; see its documentation for details.

/// Example:

use stringio::partial_from_utf8_mut;
// UTF-8 equivelent of "😀😀", minus the last byte
let mut data = [0xF0, 0x9F, 0x98, 0x80, 0xF0, 0x9F, 0x98];
let mut tail = [0xF0u8, 0x9F, 0x98];
assert_eq!(
    partial_from_utf8_mut(&mut data),
    Ok((String::from("😀").as_mut_str(), &mut tail[..])),
);