pub struct Relation {
pub expression: Expression,
pub operator: Operator,
pub range_list: RangeList,
}
Expand description
An incomplete AST representation of a plural rule. Comprises an Expression
, an Operator
, and a RangeList
.
ยงExamples
All AST nodes can be built explicitly, as seen in the example. However, due to its complexity, it is preferred to build the
AST using the parse()
function.
"i = 3"
Can be represented by the AST:
use icu::plurals::provider::rules::reference::ast::*;
Relation {
expression: Expression {
operand: Operand::I,
modulus: None,
},
operator: Operator::Eq,
range_list: RangeList(vec![RangeListItem::Value(Value(3))]),
};
Fieldsยง
ยงexpression: Expression
The plural operand variable that optionally includes an application of modulo arithmetic.
operator: Operator
The operator (equals, not equals) indicating whether the resolved expression value
at runtime should match the set of possible values in range_list
. Note: Operator::Eq
effectively means โis contained within the set ofโ.
range_list: RangeList
A sequence of RangeListItem
, each of which represents a scalar number or a numerical range,
that creates the interval set within which expression
โs resolved value should exist.
Trait Implementationsยง
impl StructuralPartialEq for Relation
Auto Trait Implementationsยง
impl Freeze for Relation
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnwindSafe for Relation
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
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>
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>
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