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