icu::plurals::provider::rules::reference

Function parse_condition

Source
pub fn parse_condition(input: &[u8]) -> Result<Condition, ParseError>
Expand description

Unicode Plural Rule parser converts an input string into an AST.

That AST can be then used by the test_condition to test against PluralOperands, to find the appropriate PluralCategory.

🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, including in SemVer minor releases. In particular, the `DataProvider` implementations are only guaranteed to match with this version's `*_unstable` providers. Use with caution.

§Examples

use icu::plurals::provider::rules::reference::parse_condition;

let input = b"i = 0 or n = 1";
assert!(parse_condition(input).is_ok());