Struct icu_plurals::PluralOperands[][src]

pub struct PluralOperands {
    pub i: u64,
    pub v: usize,
    pub w: usize,
    pub f: u64,
    pub t: u64,
    pub c: usize,
}

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

See full operands description.

Examples

From int

use icu::plurals::PluralOperands;
assert_eq!(PluralOperands {
   i: 2,
   v: 0,
   w: 0,
   f: 0,
   t: 0,
   c: 0,
}, PluralOperands::from(2_usize))

From float

use std::str::FromStr;
use icu::plurals::PluralOperands;
assert_eq!(Ok(PluralOperands {
   i: 1234,
   v: 3,
   w: 3,
   f: 567,
   t: 567,
   c: 0,
}), "-1234.567".parse())

From &str

use std::convert::TryFrom;
use icu::plurals::PluralOperands;
assert_eq!(Ok(PluralOperands {
   i: 123,
   v: 2,
   w: 2,
   f: 45,
   t: 45,
   c: 0,
}), "123.45".parse())

Fields

i: u64

Integer value of input

v: usize

Number of visible fraction digits with trailing zeros

w: usize

Number of visible fraction digits without trailing zeros

f: u64

Visible fraction digits with trailing zeros

t: u64

Visible fraction digits without trailing zeros

c: usize

Exponent of the power of 10 used in compact decimal formatting

Implementations

impl PluralOperands[src]

pub fn n(&self) -> f64[src]

Returns the number represented by this PluralOperands as floating point. The precision of the number returned is up to the representation accuracy of a double.

Trait Implementations

impl Clone for PluralOperands[src]

impl Copy for PluralOperands[src]

impl Debug for PluralOperands[src]

impl From<&'_ FixedDecimal> for PluralOperands[src]

fn from(dec: &FixedDecimal) -> Self[src]

Converts a fixed_decimal::FixedDecimal to PluralOperands. Retains at most 18 digits each from the integer and fraction parts.

impl From<u128> for PluralOperands[src]

impl From<u16> for PluralOperands[src]

impl From<u32> for PluralOperands[src]

impl From<u64> for PluralOperands[src]

impl From<u8> for PluralOperands[src]

impl From<usize> for PluralOperands[src]

impl FromStr for PluralOperands[src]

type Err = OperandsError

The associated error which can be returned from parsing.

impl PartialEq<PluralOperands> for PluralOperands[src]

impl StructuralPartialEq for PluralOperands[src]

impl TryFrom<i128> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

impl TryFrom<i16> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

impl TryFrom<i32> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

impl TryFrom<i64> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

impl TryFrom<i8> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

impl TryFrom<isize> for PluralOperands[src]

type Error = OperandsError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> ErasedDataStruct for T where
    T: Clone + Debug + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.