pub struct FnContext<'x> { /* private fields */ }Expand description
What a handler may see of the formatting context: read-only and minimal (formatting.md, “Function Handler”).
Implementations§
Source§impl<'x> FnContext<'x>
impl<'x> FnContext<'x>
Sourcepub fn equivalent(&self, value: &str, key: &str) -> Option<bool>
pub fn equivalent(&self, value: &str, key: &str) -> Option<bool>
Whether value, a string the program passed in, is canonically
equivalent to key, a string this catalog holds in NFC — the
comparison MF2 asks for between a selector value and a variant key,
and the one :string makes. Decided from the small map the catalog
carries (plan/01 §4.3), so a custom selector can make it without
the normalization tables and without allocating.
The map answers exactly for any key whose characters, decomposed,
it holds, and every key and name of the catalog is such a key.
None means that key holds a character the map does not reach, so
it cannot decide. A custom selector comparing against a string of
its own may then fall back to byte equality (value == key), which
never matches wrongly but misses equivalent spellings, or treat the
key as unsupported. An identical value, and two strings below
U+0300, are always answered; a catalog whose keys and names are all
below U+0300 carries an empty map, so there any other pair is None.