Skip to main content

text_is_ascii

Function text_is_ascii 

Source
pub fn text_is_ascii(s: &Rc<String>) -> bool
Expand description

Whether a Text is pure ASCII, answered in O(1) per call via the same (is_ascii, char_len) cache the indexing hot path uses (the first call for a given Rc/length pays the vectorized is_ascii() scan, every later one is a cache hit). The VM’s tier-up seam asks this on every hot back-edge crossing and again at every region entry: a Text-as-bytes pin is sound ONLY for ASCII (char index == byte index, char count == byte length), so a non-ASCII Text must never pin.