split_at_first_rune

Function split_at_first_rune 

Source
pub fn split_at_first_rune<'g>(ptr: *const u8, length: usize) -> usize
Expand description

equivalent to calling get_rune_cutoff_at_index with index 0

§Example

use utf8_rune::split_at_first_rune;
let bytes = "☠️skull".as_bytes();
let length = bytes.len();
let ptr = bytes.as_ptr();
assert_eq!(split_at_first_rune(ptr, length), 6);
assert_eq!(std::str::from_utf8(&bytes[0..6]), Ok("☠️"));