human-time 0.1.7

This is a library for human readable elapsed time string
Documentation
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

A Rust library for converting `Duration` to human-readable elapsed time strings. Supports time units: days, hours, minutes, seconds, milliseconds, and microseconds.

## Build & Test Commands

```bash
cargo build              # Build the library
cargo test               # Run tests
cargo clippy             # Run linter
cargo run --example <name>  # Run a specific example
cargo run --example time_string      # Basic usage example
cargo run --example time_string_with_format  # Custom format example
cargo run --example elapsed_macro    # Attribute macro example
```

## Architecture

**Core Library** (`src/lib.rs`):
- `ToHumanTimeString` trait - implements `to_human_time_string()` and `to_human_time_string_with_format()` for `Duration`
- `human_time()` - converts Duration to default format "1d,2h,3m,4s,5ms,6μs"
- `human_time_with_format()` - customizable formatting via closures

**Proc Macro Crate** (`human-time-macros` dependency):
- `#[elapsed]` attribute macro for timing functions
- Supports `output = "println"` (default), `output = "eprintln"`, or `output = "debug"`

**Examples** (`examples/`):
- `time_string.rs` - basic Duration → string conversion
- `time_string_with_format.rs` - custom format closures
- `elapsed_macro.rs` - attribute macro usage for sync and async functions

## Key Design

The `UNITS` array defines the time hierarchy in microseconds. The conversion algorithm:
1. Divides total microseconds by each unit
2. Uses remainder for next smaller unit
3. Filters out zero values
4. Reduces with format closures to final string