44 releases (breaking)
Uses new Rust 2024
| new 0.42.0 | May 7, 2026 |
|---|---|
| 0.41.0 | Mar 30, 2026 |
| 0.40.0 | Mar 3, 2026 |
| 0.37.0 | Dec 2, 2025 |
| 0.0.0 | Jun 24, 2021 |
#894 in Rust patterns
78,618 downloads per month
Used in 86 crates
(9 directly)
91KB
1.5K
SLoC
tor-units
Safe wrappers for primitive numeric types.
Overview
This crate is part of Arti, a project to implement Tor in Rust. It provides safe wrappers for primitive numeric wrappers used in other parts of Arti. In particular, it provides:
- a bounded i32 with both checked and clamping constructors,
- an integer milliseconds wrapper with conversion to
Duration - an integer seconds wrapper with conversion to
Duration - a percentage wrapper, to prevent accidental failure to divide by 100.
- a SendMeVersion which can be compared only.
Compile-time features
-
memquota-memcost-- implementtor_memquota::HasMemoryCostfor many types. (Does not actually force compiling in memory quota tracking; that'smemquotaintor-memquotaand higher-level crates.) -
full-- Enable all features above.
License: MIT OR Apache-2.0
Dependencies
~0.3–36MB
~460K SLoC