Skip to main content

class_of

Function class_of 

Source
pub const fn class_of(byte: u8) -> CharClass
Expand description

The class of one byte.

The four groups, spelled out rather than tabulated, so the two bytes that deviate from ISO 32000-1 ยง7.2.2 sit in plain sight.

use pdfrum_parser::{CharClass, class_of};

assert_eq!(class_of(b' '), CharClass::Whitespace);
// Two bytes the specification does not call whitespace, but files do.
assert_eq!(class_of(0x80), CharClass::Whitespace);
assert_eq!(class_of(0xFF), CharClass::Whitespace);
// And one it arguably should: vertical tab is a regular character.
assert_eq!(class_of(0x0B), CharClass::Regular);