#humanize #human #parse #format

humanize

Convert common things to humanized output. Parse input text in a human-friendly way.

1 unstable release

0.0.1 Jul 25, 2016

#83 in Value formatting

MIT/Apache

7KB
58 lines

humanize

Build Status

Dual licensed under the MIT and Apache 2 licenses.

Installation

This crate works with Cargo and is on crates.io. Add it to your Cargo.toml like so:

[dependencies]
humanize = "0.0.1"

Status of Implementation

Things are under active development.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

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.

Dependencies

~29KB