Struct branchless::core::formatting::Pluralize[][src]

pub struct Pluralize<'a> {
    pub amount: isize,
    pub singular: &'a str,
    pub plural: &'a str,
}
Expand description

Pluralize a quantity, as appropriate. Example:

let p = Pluralize { amount: 1, singular: "thing", plural: "things"};
assert_eq!(p.to_string(), "1 thing");

let p = Pluralize { amount: 2, singular: "thing", plural: "things"};
assert_eq!(p.to_string(), "2 things");

Fields

amount: isize

The amount of the quantity.

singular: &'a str

The string to render if the amount is singular.

plural: &'a str

The string to render if the amount is plural.uee

Trait Implementations

Converts the given value to a String. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.