Crate faster_chars_count[][src]

Expand description

Library for counting length of chars faster than chars().count()

use faster_chars_count::*;
let a = "rust=錆;rust=錆;rust=錆;rust=錆;rust=錆;";
assert_eq!(a.chars().count(), chars_count_str(a));
assert_eq!(a.chars().count(), a.chars_count());

Idea is that we only needs to count the byte witch is not a continuation byte. This can be done at the same time for 4byte (u64) or 32byte (__m256i with avx2).

Traits

CharsCount

Trait for counting chars faster than chars().count()

Functions

chars_count_byte

Function version of faster chars_count() for &[u8]

chars_count_str

Function version of faster chars_count()