#tor #value #tor-arti #arti

tor-units

Provides macros for types which are constrained within a range, ensuring invalid values are unrepresentable

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

Download history 2559/week @ 2026-01-16 3141/week @ 2026-01-23 3855/week @ 2026-01-30 3427/week @ 2026-02-06 3672/week @ 2026-02-13 4379/week @ 2026-02-20 4274/week @ 2026-02-27 7083/week @ 2026-03-06 8206/week @ 2026-03-13 7710/week @ 2026-03-20 5862/week @ 2026-03-27 5173/week @ 2026-04-03 8887/week @ 2026-04-10 9774/week @ 2026-04-17 11252/week @ 2026-04-24 47638/week @ 2026-05-01

78,618 downloads per month
Used in 86 crates (9 directly)

MIT/Apache

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 -- implement tor_memquota::HasMemoryCost for many types. (Does not actually force compiling in memory quota tracking; that's memquota in tor-memquota and higher-level crates.)

  • full -- Enable all features above.

License: MIT OR Apache-2.0

Dependencies

~0.3–36MB
~460K SLoC