get_valid_utf8_str_of

Function get_valid_utf8_str_of 

Source
pub fn get_valid_utf8_str_of<'g>(
    src: *const u8,
    index: usize,
    count: usize,
) -> Option<&'g str>
Expand description

retrieves Some() valid str slice of N bytes from contiguous memory area or None if the resulting sequence of bytes is not valid UTF-8.

Example

use utf8_rune::pointer::get_valid_utf8_str_of;
let ptr = "UNICODE".as_bytes().as_ptr();
assert_eq!(get_valid_utf8_str_of(ptr, 2, 3), Some("ICO"));