pub enum ClassTest<'a> {
Flat(&'a dyn Fn(&str, &str) -> String),
Folded,
}Expand description
How an engine asks whether a text holds a character of a class, for
read_with_safe_cast and read_with_digit_check.
The readers hold a value to the picture’s shape. Flat, each rule is one
test beside the next, each naming the value once and nesting nothing, so a
value is no deeper than its marks’ own REPLACEs: an engine whose parser
holds a hundred levels — SQLite 3.45’s — reads a wide table. Two of the
rules need a class of characters (a digit; anything but a digit, a point
or a minus), and that is what an engine is asked for here.
Variants§
Flat(&'a dyn Fn(&str, &str) -> String)
The engine’s own test: given a text and a bracket class — [0-9]
or [^0-9.-], the spelling GLOB, SQL Server’s LIKE and every
regular expression share — a condition true where the text holds at
least one character of the class: x GLOB '*[0-9]*',
x LIKE '%[0-9]%', REGEXP_LIKE(x, '[0-9]').
Folded
No such test: the value’s digits are folded with REPLACE into
one shape and that is asked with LIKE alone, about twenty calls deep
over the value. Ask for it only where the engine has neither a bracket
class nor a regular expression.