Module intl_pluralrules::operands[][src]

Expand description

A public AST module for plural rule representations. Plural operands in compliance with CLDR Plural Rules.

See full operands description.

Examples

From int

use std::convert::TryFrom;
use intl_pluralrules::operands::*;
assert_eq!(Ok(PluralOperands {
   n: 2_f64,
   i: 2,
   v: 0,
   w: 0,
   f: 0,
   t: 0,
}), PluralOperands::try_from(2))

From float

use std::convert::TryFrom;
use intl_pluralrules::operands::*;
assert_eq!(Ok(PluralOperands {
   n: 1234.567_f64,
   i: 1234,
   v: 3,
   w: 3,
   f: 567,
   t: 567,
}), PluralOperands::try_from("-1234.567"))

From &str

use std::convert::TryFrom;
use intl_pluralrules::operands::*;
assert_eq!(Ok(PluralOperands {
   n: 123.45_f64,
   i: 123,
   v: 2,
   w: 2,
   f: 45,
   t: 45,
}), PluralOperands::try_from(123.45))

Structs

A full plural operands representation of a number. See CLDR Plural Rules for complete operands description.