| Crates.io | utilities_rs |
| lib.rs | utilities_rs |
| version | 1.0.0 |
| created_at | 2026-01-20 15:56:11.211948+00 |
| updated_at | 2026-01-20 15:56:11.211948+00 |
| description | A small library of Rust utilities |
| homepage | |
| repository | https://github.com/nessan/utilities_rs |
| max_upload_size | |
| id | 2056899 |
| size | 23,514 |
The utilities_rs crate is a small collection of useful Rust traits, types, functions, and macros:
| Module | Description |
|---|---|
stopwatch |
Provides the Stopwatch type that is used to measure the time taken by a code block. |
pretty |
Provides a trait and functions that inject separators into the strings for large numbers to enhance readability. |
repeat |
Provides a macro to create repeated invocations of any macro over a list of arguments. |
The Stopwatch type provides simple, effective timing for code execution. It measures the elapsed time in seconds from a zero-time, which is set at construction time or by calling Stopwatch::reset. The primary goal is ease of use, and the type is kept deliberately simple. Use a Stopwatch for cheap-and-cheerful performance measurement. It is not a replacement for the many more complete but more complex code profiling tools.
The [Pretty][] trait and pretty() function inject separators into the string representations of large numbers to enhance readability. For example, the number 10000000.1234 can be represented as 10,000,000.1234 or 1_0000_0000.1234, depending on the chosen separator and grouping size.
The repeat! macro creates repeated invocations of another macro over a list of arguments or pairs of arguments. Rust's declarative macros are often write-once type structures because the syntax used is peppered with parentheses, dollar signs, and if you use repetition, yet more parentheses, asterisks, and plus signs. The repeat! macro is designed to remove one layer of confusing punctuation.
To include the utilities_rs crate in your Rust project, add the following line to your Cargo.toml file:
[dependencies]
utilities_rs = "1.0.0"
Copyright (c) 2025-present Nessan Fitzmaurice.
You can use this software under the MIT License