pub struct Condition(pub Vec<AndCondition>);
Expand description
A complete AST representation of a plural rule’s condition. Comprises a vector of AndConditions
.
🚧 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::ast::*;
use icu::plurals::provider::rules::reference::parse_condition;
let condition = Condition(vec![
AndCondition(vec![Relation {
expression: Expression {
operand: Operand::I,
modulus: None,
},
operator: Operator::Eq,
range_list: RangeList(vec![RangeListItem::Value(Value(5))]),
}]),
AndCondition(vec![Relation {
expression: Expression {
operand: Operand::V,
modulus: None,
},
operator: Operator::Eq,
range_list: RangeList(vec![RangeListItem::Value(Value(2))]),
}]),
]);
assert_eq!(
condition,
parse_condition(b"i = 5 or v = 2").expect("Parsing failed")
)
Tuple Fields§
§0: Vec<AndCondition>
Trait Implementations§
impl StructuralPartialEq for Condition
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnwindSafe for Condition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more