2 unstable releases

0.2.0 Dec 30, 2024
0.1.0 Jun 10, 2021

#417 in Value formatting

Download history 15/week @ 2025-09-16 26/week @ 2025-09-23 31/week @ 2025-09-30 17/week @ 2025-10-07 36/week @ 2025-10-14 41/week @ 2025-10-21 18/week @ 2025-10-28 16/week @ 2025-11-04 12/week @ 2025-11-11 20/week @ 2025-11-18 23/week @ 2025-11-25 17/week @ 2025-12-02 51/week @ 2025-12-09 19/week @ 2025-12-16 15/week @ 2025-12-23 11/week @ 2025-12-30

98 downloads per month
Used in 5 crates

MIT license

24KB
590 lines

friendly is a human-readable display library.

This module provides a convenient, uniform way to display various types of quantities in approximate, human-readable format. For example:

# use friendly::bytes;
let kb = format!("{}", bytes(13200));
assert_eq!(kb.as_str(), "12.89 KiB")

The various functions provide quick ways to wrap values and types in the appropriate objects to facilitate their display. Types such as [Quantity] then provide methods to further customize this presentation.

Right now this crate supports a few useful types, but has much more to add. Contributions (via pull requests) are most welcome! Please make sure you include tests, though.

Features

This crate supports some features:

  • chrono — enables support for types from the Chrono crate (currently just chrono::Duration)

Dependencies

~81–400KB