ms-rs

Crates.ioms-rs
lib.rsms-rs
version0.1.0
created_at2024-06-03 15:36:31.662706+00
updated_at2024-06-03 15:36:31.662706+00
descriptionA Rust library that replicates the ms package from TypeScript for Rust.
homepagehttps://github.com/smartarray/ms-rs
repositoryhttps://github.com/smartarray/ms-rs
max_upload_size
id1260224
size8,741
Yoshi Jäger (SmartArray)

documentation

README

ms-rs ⏱️

ms-rs 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, ms-rs 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.

Usage:

Add ms-rs to your Cargo.toml:

[dependencies]
ms-rs = "0.1.0"

Then use it in your code:

use ms_rs::ms;

fn main() {
    let ms = ms("2 days").unwrap();
    println!("{}", ms); // Outputs: 172800000

    let time_str = ms(172800000);
    println!("{}", time_str); // Outputs: "2 days"
}

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.

Commit count: 0

cargo fmt