Module intl_pluralrules::operands

source ·
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 intl_pluralrules::operands::*;
assert_eq!(Ok(PluralOperands {
   n: 2_f64,
   i: 2,
   v: 0,
   w: 0,
   f: 0,
   t: 0,
}), PluralOperands::from(2))

From float

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

From &str

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

Structs§

Traits§

  • A trait that can be implemented on any type to allow it for passing to select. This trait is made public for implementations of custom types. If you are using generic types, you should use from.