pretty-duration 0.1.1

Rust library that takes a duration and returns a string that is prettier to read for a human. The format of the duration can be customized in a short and long format and can be localized.
Documentation
  • Coverage
  • 23.08%
    6 out of 26 items documented1 out of 1 items with examples
  • Size
  • Source code size: 37.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.28 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MrDesjardins/pretty-duration
    1 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MrDesjardins

Humanify Duration

codecov

Rust library that takes a duration and returns a string that is prettier to read for a human

Consumer of the Library

Install

cargo add pretty-duration

How to use?

use pretty_duration::pretty_duration;
use std::time::Duration;
let result = pretty_duration(&Duration::from_millis(1), None);

As a Developer of the Library

Tests

cargo test

Tests Coverage

You must install few components before running coverage:

cargo install grcov

rustup component add llvm-tools-preview

Then, you can run:

export RUSTFLAGS="-Cinstrument-coverage"

cargo build

export LLVM_PROFILE_FILE="profile-%p-%m.profraw"

cargo test

grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

Further explanation in the Mozilla grcov website

Documentation

cargo doc --open

Publishing

cargo login

cargo publish --dry-run

cargo publish