humfmt 0.1.1

Ergonomic human-readable number formatting for Rust
Documentation
<div align="center">

# humfmt


**Ergonomic human-readable formatting toolkit for Rust**

[![CI](https://github.com/MuXolotl/humfmt/actions/workflows/ci.yml/badge.svg)](https://github.com/MuXolotl/humfmt/actions/workflows/ci.yml)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Status](https://img.shields.io/badge/status-actively--developing-brightgreen.svg)

</div>

---

`humfmt` is a lightweight Rust library for turning raw machine values into human-friendly text.

Designed to provide:

- compact number rendering (`15320 -> 15.3K`)
- fluent builder-style customization
- locale-ready suffix formatting
- ergonomic extension trait API
- `no_std`-friendly usage with `alloc`
- zero-macro, zero-nonsense usage

The crate aims to be tiny, intuitive, and pleasant enough that formatting stops feeling like work.

---

## ✨ Quick Example


```rust
use humfmt::Humanize;

fn main() {
    println!("{}", humfmt::number(15320));          // 15.3K
    println!("{}", 1_500_000.human_number());      // 1.5M
}
```

---

## βš™οΈ Customized Formatting


```rust
use humfmt::{Humanize, NumberOptions};

fn main() {
    let out = 15_320.human_number_with(
        NumberOptions::new()
            .precision(2)
            .long_units()
    );

    println!("{out}"); // 15.32 thousand
}
```

---

## βœ… Current Features


* [x] Compact number formatter
* [x] Builder-style `NumberOptions`
* [x] `Humanize` extension trait
* [x] Long and short suffix units
* [x] Locale abstraction foundation
* [x] Doctests and integration tests

---

## πŸ—ΊοΈ Planned Roadmap


Upcoming humanizers planned for future releases:

* [ ] `bytes()` β€” human-readable byte sizes
* [ ] `duration()` β€” compact duration formatting
* [ ] `ago()` β€” relative time rendering
* [ ] `ordinal()` β€” 1st / 2nd / 3rd style helpers
* [ ] additional locale packs
* [ ] zero-allocation optimization pass

---

## πŸ“¦ Installation


Add dependency:

```toml
[dependencies]
humfmt = "0.1"
```

For `no_std` targets with `alloc` available:

```toml
[dependencies]
humfmt = { version = "0.1", default-features = false }
```

---

## Feature Flags


- `std` (default): enables the standard-library build.
- `default-features = false`: builds the current formatter on `no_std` + `alloc`.
- `english` stays in the default set for forward-compatible locale gating in `0.1.x`.
- `alloc`, `russian`, and `polish` are reserved compatibility flags in `0.1.x`; they do not change runtime behavior yet.
- `chrono` and `time` keep their optional dependencies wired and CI-checked, but no public integration API is exposed yet.

---

## πŸ§ͺ Development Status


`humfmt` is under active early-stage development.

The current public surface is intentionally small and focused on compact number formatting first.

Expect rapid iteration, formatter additions, and locale improvements.

---

## πŸ“š Documentation


* examples available in `/examples`
* integration tests available in `/tests`
* rustdoc examples available on all public number APIs
* published crate: <https://crates.io/crates/humfmt>
* API docs: <https://docs.rs/humfmt>

---

## πŸ“„ License


Licensed under MIT.

---

## ⭐ Philosophy


This crate follows one simple rule:

> Human formatting should feel stupidly easy.

No giant config structs.
No formatting gymnastics.
No "why is this so annoying?" moments.

Just:

```rust
println!("{}", 1500000.human_number());
```

and move on with your life.