Skip to main content

Crate ferrocat_icu

Crate ferrocat_icu 

Source
Expand description

Compact, performance-oriented ICU MessageFormat parsing primitives.

§Examples

use ferrocat_icu::{extract_variables, parse_icu};

let message = parse_icu("Hello {name}, you have {count, plural, one {# item} other {# items}}.")?;
assert_eq!(extract_variables(&message), vec!["name", "count"]);

Structs§

IcuMessage
Parsed ICU message.
IcuOption
A selector branch inside a plural or select expression.
IcuParseError
Error returned when parsing ICU messages fails.
IcuParserOptions
Options controlling ICU parsing behavior.
IcuPosition
Byte offset plus line/column location inside the original input.

Enums§

IcuErrorKind
High-level classification of ICU parse failures.
IcuNode
AST node emitted by the ICU parser.
IcuPluralKind
Distinguishes cardinal and ordinal plural forms.

Functions§

extract_variables
Extracts variable names in first-seen order.
has_plural
Returns true when the message contains a cardinal plural expression.
has_select
Returns true when the message contains a select expression.
has_selectordinal
Returns true when the message contains an ordinal plural expression.
has_tag
Returns true when the message contains rich-text style tags.
parse_icu
Parses ICU MessageFormat input with the default parser options.
parse_icu_with_options
Parses ICU MessageFormat input with explicit parser options.
validate_icu
Validates ICU MessageFormat input without returning the parsed AST.