#human #parse #format #parse-input #parser

humanize

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

1 unstable release

Uses old Rust 2015

0.0.1 Jul 25, 2016

#28 in #parse-input


Used in systeminfo

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

~485KB
~12K SLoC