Crate humanize

Source
Expand description

§Humanize

Make your user interface more human friendly!

This library provides functionality for both formatting values into human friendly forms as well as parsing human input to get back likely values.

Actually, the formatting isn’t implemented yet. Contributions are welcome!

This library is inspired by many other things, including:

Contributions extending our functionality are welcome, as are contributions that add support for additional languages.

§Human-friendly Parsing

When dealing with humans, you often want them to be able to input values in a flexible manner. For example, you might want to be able to input a bool using text like "on", "off", "yes", "no" or perhaps even "nope".

let enabled = humanize::parse::<bool>("on").unwrap_or(false);
assert_eq!(enabled, true);

§Ideas for the Future

  • Actually implement formatting.

Modules§

boolean
Boolean Humanization

Traits§

Parse
Construct Self by parsing humanized text.

Functions§

parse
Construct a value by parsing humanized text.
parse_with_language
Construct a value by parsing humanized text using the specified language.