Trait dactyl::traits::NiceInflection
source · pub trait NiceInflection: Inflection {
// Required method
fn nice_inflect<S>(self, singular: S, plural: S) -> String
where S: AsRef<str>;
}
Expand description
§Nice Inflection.
This extends the Inflection
trait for types which can be represented as
one of the NiceU*
types, and their signed equivalents (minus signs will
be prepended as necessary), i.e. i/u/NonZeroU 8–64
.
Required Methods§
sourcefn nice_inflect<S>(self, singular: S, plural: S) -> String
fn nice_inflect<S>(self, singular: S, plural: S) -> String
§Inflect a String (Prefixed w/ Value)
This is like Inflection::inflect
, but prefixes the output with a
nicely-formatted representation of the numeric value.
§Examples
use dactyl::traits::NiceInflection;
assert_eq!(
3283.nice_inflect("book", "books"),
"3,283 books"
);
Object Safety§
This trait is not object safe.