ms2-rs
⏱️
ms2 is a Rust library that recreates the ms package from TypeScript for Rust. It helps you convert milliseconds to human-readable time strings and vice versa. If you need to work with time in your Rust project, ms2 makes it easy.
Features:
- ⏳ Convert time strings (like "2 days") to milliseconds.
- ⏱️ Convert milliseconds to time strings.
- ⏲️ Supports common time units like seconds, minutes, hours, and days.
- 👍 Easy-to-use API based on the ms package from TypeScript.
- 🍒 Possibility to import
format
orparse
to use explicit and typesafe methods
Usage:
Add ms2 to your Cargo.toml:
[]
= "0.2.0"
Then use it in your code:
use ms;
Using ms2
with an integer input to convert to a human-readable string
use ms;
Using the convenience methods unwrap_number
and unwrap_str
use ;
Use raw explicit and typesafe methods format
and parse
use ;
Support for negative values
use ;
Contributing:
Contributions are welcome! Check the CONTRIBUTING.md
file for more info.
License:
This project is licensed under the MIT License. See the LICENSE file for details.