Skip to main content

is_ascii_case_insensitive_html_attribute

Function is_ascii_case_insensitive_html_attribute 

Source
fn is_ascii_case_insensitive_html_attribute(name: &str) -> bool
Expand description

Whether name, which must already be ASCII-lowercased, is an attribute that HTML matches ASCII-case-insensitively, as per1.

A matches! over string literals lowers to a jump table on the string length followed by inlined constant-width comparisons 2. For a set this small that measures several times faster than either a perfect hash (which has to hash the name first) or a binary search (which spends its time on mispredicted branches).