pub fn parse_plural_rule<S: AsRef<str>>(source: S) -> Result<ast::Rule, String> {
    match parser::parse_rule(source.as_ref()) {
        Ok(("", rule)) => Ok(rule),
        //Ok((_, rule)) => Ok(rule),
        Ok((left, _)) => Err(format!("Left string: {}", left)),
        _ => Err("Parser failed".to_string()),
    }
}
/// Given a string reference of a plural rule, will return the AST representation of that rule.
///
/// # Examples
///
/// ```
/// use cldr_pluralrules_parser::parse_plural_rule;
/// use cldr_pluralrules_parser::ast::*;
///
/// let condition = Condition(vec![
///     AndCondition(vec![Relation {
///         expression: Expression {
///             operand: Operand::I,
///             modulus: None,
///         },
///         operator: Operator::Is,
///         range_list: RangeList(vec![RangeListItem::Value(Value(5))]),
///     }]),
///     AndCondition(vec![Relation {
///         expression: Expression {
///             operand: Operand::V,
///             modulus: None,
///         },
///         operator: Operator::Within,
///         range_list: RangeList(vec![RangeListItem::Value(Value(2))]),
///     }]),
/// ]);
///
/// assert_eq!(
///     condition,
///     parse_plural_rule("i is 5 or v within 2")
///         .expect("Parsing succeeded")
///         .condition
/// )
/// ```
Given a string reference of a plural rule, will return the AST representation of that rule.
Given a string reference of a plural rule will return the AST representation of that rule .
pub fn parse_plural_rule<S: AsRef<str>>(source: S) -> Result<ast::Rule, String> {
    match parser::parse_rule(source.as_ref()) {
        Ok(("", rule)) => Ok(rule),
        //Ok((_, rule)) => Ok(rule),
        Ok((left, _)) => Err(format!("Left string: {}", left)),
        _ => Err("Parser failed".to_string()),
    }
}
pub fn parse_plural_rule < S : AsRef < str > > ( source : S ) -> Result < ast :: Rule , String > { match parser :: parse_rule ( source . as_ref ( ) ) { Ok ( ( " " , rule ) ) => Ok ( rule ) , //Ok((_, rule)) => Ok(rule), Ok ( ( left , _ ) ) => Err ( format ! ( " " left ) ) , _ => Err ( " " . to_string ( ) ) , } }
Given a string reference of a plural rule, will return the AST representation of that rule.
Given a string reference of a plural rule will return the AST representation of that rule .
source
S
source
S
examples
```
use cldr_pluralrules_parser::parse_plural_rule;
use cldr_pluralrules_parser::ast::*.

let condition = Condition(vec![
AndCondition(vec![Relation {
expression: Expression {
operand: Operand::I,
modulus: None,
},
operator: Operator::Is,
range_list: RangeList(vec![RangeListItem::Value(Value(5))]),
}]),
AndCondition(vec![Relation {
expression: Expression {
operand: Operand::V,
modulus: None,
},
operator: Operator::Within,
range_list: RangeList(vec![RangeListItem::Value(Value(2))]),
}]),
]).

assert_eq!(
condition,
parse_plural_rule("i is 5 or v within 2")
.expect("Parsing succeeded")
.condition
)
```
` ` ` use cldr_pluralrules_parser :: parse_plural_rule ; use cldr_pluralrules_parser :: ast :: * . let condition = Condition ( vec! [ AndCondition ( vec! [ Relation { expression : Expression { operand : Operand :: I modulus : None } operator : Operator :: Is range_list : RangeList ( vec! [ RangeListItem :: Value ( Value ( 5 )) ] ) } ] ) AndCondition ( vec! [ Relation { expression : Expression { operand : Operand :: V modulus : None } operator : Operator :: Within range_list : RangeList ( vec! [ RangeListItem :: Value ( Value ( 2 )) ] ) } ] ) ] ) . assert_eq! ( condition parse_plural_rule ( " i is 5 or v within 2 " ) . expect ( " Parsing succeeded " ) . condition ) ` ` `