typenum
Typenum is a Rust library for type-level numbers evaluated at compile time. It currently supports bits, unsigned integers, and signed integers. It also provides a type-level array of type-level numbers, but its implementation is incomplete.
1.20.1
824M downloads/mo
#83 most downloaded on crates.io
paholg/typenum
What this package is like to depend on
Last release 2 months ago
29 May 2026
Ships fairly regularly
a new release about every 8 months
Most releases are documented
notes for 25 of 34 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
34 releases · first in 2015
3 releases in the last 12 months
see the full history below
Release timeline
34 releases · Sep 2015 to May 2026Releases
latest 34-
1.20.129 May 2026 -
1.20.019 Apr 2026Release notes
Open source →- [removed] Removed
no_stdfeature flag (deprecated since 1.3.0) - [removed] Removed
force_unix_path_separatorfeature flag (deprecated since 1.17.0) - [changed] Replaced
build.rsscript with pre-generated test files - [added] Indexing into tuples
- [changed] MSRV now 1.41.0
- [removed] Removed
-
1.19.002 Oct 2025Release notes
Open source →Chores
- exclude some files from published crates (#223) #223 (Fabio Valentini)
Commits
- 5ab37fa: Mark generated files with git attribute (#222) (David Tolnay) #222
- 7ceeb76: fix tarr! pattern match (#225) (Kyle Gullion) #225
- e71d144: Fix const-generics feature on 16-bit targets (#224) (Robin Krahl) #224
- 6b1603e: Remove deprecated feature flag from lib.rs (#231) (Yuki Okushi) #231
- f86d468: Fix CI job (Paho Lurie-Gregg)
- da36818: Remove wrong documentation about type operators (#229) (Asger Hautop Drewsen) #229
- 9b05f6c: Add core::fmt::Binary support for integers (#228) (Asger Hautop Drewsen) #228
- 44eece3: Add constants for powers of two minus one (#227) (Asger Hautop Drewsen) #227
- 39492ae: add implementations for ToInt for isize, i128, and u128 (#230) (blacktemplar) #230
- 65d1738: Version 1.19.0 (#235) (Paho Lurie-Gregg) #235
Release notes
Open source →- [fixed] Conflicting trait implementations with the
const-genericsfeature on 16-bit targets - [fixed] Remove deprecated feature flag
- [added] Support
core::fmt::Binary - [added] Constants for 2^N - 1
- [added] Implemented
ToIntforisize,i128, andu128
-
1.18.018 Feb 2025Release notes
Open source →Features
FoldAddandFoldMul(#209) #209 (Daniel-Aaron-Bloom)
Commits
- b237efb: Version v1.17.0 (#200) (Paho Lurie-Gregg) #200
- 68980e9: add elixir style capturing of the rest of the array (Kyle Gullion) #214
- 21c7d60: Setup nix flake (Paho Lurie-Gregg)
- 137863c: Fix CI build, introduce justfile (#218) (Paho Lurie-Gregg) #218
- bab772b: Check-in generated code (#219) (Paho Lurie-Gregg) #219
- 9eec4b7: Add constant for 3600 (#220) (Paho Lurie-Gregg) #220
- 4bccf7d: Setup nix flake (Paho Lurie-Gregg)
- 372a281: Fix CI build, introduce justfile (#218) (Paho Lurie-Gregg)
- 83e03f5: Check-in generated code (#219) (Paho Lurie-Gregg)
- 74d63c1: Add constant for 3600 (#220) (Paho Lurie-Gregg)
- 2488205: Merge branch 'kgullion-elixir-style-tarr' (Paho Lurie-Gregg)
- 67584b5: Version 1.18 (#221) (Paho Lurie-Gregg) #221
Release notes
Open source →- [changed] Remove build scripts; instead check-in the built code (PR #219)
- [added] Constants for 3600 (PR #220)
- [added] Elixir-style syntax for
tarr!macro (PR #214) - [added]
FoldAddandFoldMulto get the sum/product of an array (PR #209)
-
1.17.015 Sep 2023Release notes
Open source →Features
Commits
- bc7ca1d: Fix a few typos (#186) (Dirk Stolle) #186
- f03b486: Update actions/checkout in GitHub Actions to v3 (#187) (Dirk Stolle) #187
- 1871986: Migrate from actions-rs (#193) (Paho Lurie-Gregg) #193
- 163a6ae: Fix typo in array.rs comments (#196) (Jaanus Varus) #196
- 530ec75: Add CI for 32-bit and big-endian platforms (#198) (James McCoy) #198
- bbac3bf: Improve docs.rs builds (#195) (Nova) #195
- b237efb: Version v1.17.0 (#200) (Paho Lurie-Gregg) #200
Release notes
Open source →- [removed] Remove
force_unix_path_separatorfeature, make it the default - [added] docs.rs metadata and cfg options
- [added] Playground metadata
-
1.16.005 Dec 2022Release notes
Open source →Commits
- f3e1972: Add generic
constmappings (Daniel Henry-Mantilla) #176 - 7d3ee8f: Dev QoL: allow caching the
build.rsexecution (Daniel Henry-Mantilla) #176 - 077aa83: Improve the readability of the main page docs, w.r.t. the consts exported (Daniel Henry-Mantilla) #176
- 2ad6e88: Bump the version (Daniel Henry-Mantilla) #176
- cb3d2d5: Add a
constfield to theToInttrait to allow its use inconstcontexts (#179) (winestone) #179 - d3b30c8: Do not emit unnecessary "cargo:rustc-env=" instructions. (#184) (Dinu Blanovschi) #184
- cf9f811: Merge branch 'main' into main (Paho Lurie-Gregg) #176
- ba67264: Bump to version 1.16 (#185) (Paho Lurie-Gregg) #185
Release notes
Open source →- [added]
const INTfield to theToInttrait. - [added]
const-genericsfield withU<N>mapping whereNis a const generic.
- f3e1972: Add generic
-
1.15.026 Dec 2021Release notes
Open source →- [fixed] Cross-compilation issue due to doing math in build script. (PR #177)
- [added] New feature
scale_infofor using inside Substrate-based runtimes (PR #175)
-
1.14.001 Sep 2021Release notes
Open source →- [changed] Sealed all marker traits. Documentation already stated that these should not be implemented outside the crate, so this is not considered a breaking change.
-
1.13.013 Mar 2021Release notes
Open source →Commits
- [21e6a44]: Clarification of MIT, Apache-2.0 dual license (Akhil Velagapudi)
- [8362450]: Fix date in changelog (Paho Lurie-Gregg)
- [d8786ab]: Add impl Pow<NInt<...>> for f{32,64} (Waffle) #151
- [841b7a3]: update changelog (Waffle) #151
- [a0be662]: allow calling
assert_type{,_eq}!at top-level & const ctx (Waffle) #152 - [3589cd4]: Add rustfmt.toml to format Rust code in doc comments (jerry73204) #155
- [4e145da]: Add Zero trait (jerry73204) #137
- [466df16]: Introduce ToInt type operator (jerry73204) #135
- [56ca838]: Use edition 2018 (fixes #138) (jerry73204) #156
- [5cf10f7]: Add
local_inner_macrosfor 2018 edition support. (Charles Lew) #160 - [581bc6b]: Update default branch (Paho Lurie-Gregg)
- [bf75832]: Appease clippy (#164) (Paho Lurie-Gregg) #164
- [c27b83e]: Explore GitHub Actions instead of Travis (#165) (Paho Lurie-Gregg) #165
- [7e723d0]: Add rustfmt.toml to format Rust code in doc comments (#155) (jerry73204) #155
- [92504db]: Update build badge (Paho Lurie-Gregg)
- [64a1993]: Add new() method to Bit trait (#141) (jerry73204) #141
- [2955684]: Merge branch 'const_assert_ty_eq' of https://github.com/WaffleLapkin/typenum into WaffleLapkin-const_assert_ty_eq (Paho Lurie-Gregg) #152
- [87f87e8]: Merge branch 'WaffleLapkin-const_assert_ty_eq' (Paho Lurie-Gregg)
- [80fbdeb]: Merge branch 'main' of github.com:paholg/typenum (Paho Lurie-Gregg)
- [f4305c3]: Merge branch '2018-edition' of git://github.com/jerry73204/typenum into jerry73204-2018-edition (Paho Lurie-Gregg) #156
- [1043b4c]: Merge branch 'jerry73204-2018-edition' (Paho Lurie-Gregg)
- [b62d84b]: Run fmt on nightly (Paho Lurie-Gregg)
- [98a8903]: Merge branch 'zero-marker' of git://github.com/jerry73204/typenum into jerry73204-zero-marker (Paho Lurie-Gregg) #137
- [51554a6]: Merge branch 'jerry73204-zero-marker' (Paho Lurie-Gregg)
- [932263f]: Update changelog (Paho Lurie-Gregg)
- [72f4f52]: Merge branch 'float_to_neg_exp' of git://github.com/WaffleLapkin/typenum into WaffleLapkin-float_to_neg_exp (Paho Lurie-Gregg) #151
- [4baa893]: Add inline to powi (Paho Lurie-Gregg)
- [f8845f9]: Merge branch 'WaffleLapkin-float_to_neg_exp' (Paho Lurie-Gregg)
- [e27c19f]: Merge branch 'license-clarification' (Paho Lurie-Gregg)
- [7e3a878]: Build on all OSes (#166) (Paho Lurie-Gregg) #166
- [98a1fd4]: Merge branch 'feature-to-arbitrary-int' of git://github.com/jerry73204/typenum into jerry73204-feature-to-arbitrary-int (Paho Lurie-Gregg) #135
- [51882b8]: Merge branch 'jerry73204-feature-to-arbitrary-int' (Paho Lurie-Gregg)
- [39eedb7]: Update changelog (Paho Lurie-Gregg)
- [83a09af]: linewrap md files at 80 (Paho Lurie-Gregg) #167
- [a394b35]: Add publish action (Paho Lurie-Gregg) #167
- [104e009]: Update version to 1.13 (Paho Lurie-Gregg) #168
Release notes
Open source →- [changed] MSRV from 1.22.0 to 1.37.0.
- [fixed]
opmacro with 2018 edition import. - [changed] Allowed calling
assert_type_eqandassert_typeat top level. - [added] Marker trait
ZeroforZ0,U0, andB0. - [added] Implementation of
Powtrait for f32 and f64 with negative exponent. - [added] Trait
ToInt.
-
1.12.014 Apr 2020Release notes
Open source →- [added] Feature
force_unix_path_separatorto support building without Cargo. - [added] Greatest common divisor operator
Gcdwith aliasGcf. - [added]
gcdto theop!macro. - [changed] Added
Copybound toRhsofMul<Rhs>impl for<TArr<V, A>. - [changed] Added
Copybound toRhsofDiv<Rhs>impl for<TArr<V, A>. - [changed] Added
Copybound toRhsofPartialDiv<Rhs>impl for<TArr<V, A>. - [changed] Added
Copybound toRhsofRem<Rhs>impl for<TArr<V, A>. - [fixed] Make all functions #[inline].
- [added] Feature
-
1.11.226 Aug 2019 -
1.11.126 Aug 2019Release notes
Open source →- [fixed] Builds on earlier Rust builds again and added Rust 1.22.0 to Travis to prevent future breakage.
-
1.11.025 Aug 2019Release notes
Open source →- [added] Integer
log2to theop!macro. - [added] Integer binary logarithm operator
Logarithm2with aliasLog2. - [changed] Removed
feature(i128_type)when running with thei128feature. Kept the feature flag. for typenum to maintain compatibility with old Rust versions. - [added] Integer
sqrtto theop!macro. - [added] Integer square root operator
SquareRootwith aliasSqrt. - [fixed] Bug with attempting to create U1024 type alias twice.
- [added] Integer
-
1.10.011 Mar 2018Release notes
Open source →- [added] The
PowerOfTwomarker trait. - [added] Associated constants for
Bit,Unsigned, andInteger.
- [added] The
-
1.9.014 May 2017Release notes
Open source →- [added] The
Abstype operator and correspondingAbsValalias. - [added] The feature
i128that enables creating 128-bit integers from typenums. - [added] The
assert_type!andassert_type_eq!macros. - [added] Operators to the
op!macro, including those performed bycmp!. - [fixed] Bug in
op!macro involving functions and convoluted expressions. - [deprecated] The
cmp!macro.
- [added] The
-
1.8.013 Apr 2017Release notes
Open source →- [added] The
op!macro for conveniently performing type-level operations. - [added] The
cmp!macro for conveniently performing type-level comparisons. - [added] Some comparison type-operators that are used by the
cmp!macro.
- [added] The
-
1.7.025 Mar 2017Release notes
Open source →- [added] Type operators
MinandMaxwith accompanying aliasesMinimumandMaximum
- [added] Type operators
-
1.6.024 Feb 2017Release notes
Open source →- [fixed] Bug in
Arraydivision. - [fixed] Bug where
Remwould sometimes exit early with the wrong answer. - [added]
PartialDivoperator that performs division as a partial function -- it's defined only when there is no remainder.
- [fixed] Bug in
-
1.5.204 Feb 2017 -
1.5.108 Nov 2016 -
1.5.003 Nov 2016Release notes
Open source →- [added] Functions to the
PowandLentraits. This is technically a breaking change, but it would only break someone's code if they have a custom impl forPow. I would be very surprised if that is anyone other than me.
- [added] Functions to the
-
1.4.029 Oct 2016Release notes
Open source →- [added] Type-level arrays of type-level integers. (PR #66)
- [added] The types in this crate are now instantiable. (Issue #67, PR #68)
-
1.3.208 Jul 2016Nothing published for this version
-
1.3.101 Apr 2016 -
1.3.007 Feb 2016Release notes
Open source →- [changed] Removed dependency on libstd. (Issue #53, PR #55)
- [changed] Reorganized module structure. (PR #57)
-
1.2.003 Jan 2016Release notes
Open source →- [added] This change log!
- [added] Convenience type aliases for operators. (Issue #48, PR #50)
- [added] Types in this crate now derive all possible traits. (Issue #42, PR #51)
-
1.1.024 Nov 2015Nothing published for this version
-
1.0.220 Nov 2015Nothing published for this version
-
1.0.119 Oct 2015Nothing published for this version
-
1.0.019 Oct 2015Nothing published for this version
-
0.1.116 Oct 2015Nothing published for this version
-
0.1.012 Oct 2015Nothing published for this version
-
0.0.205 Oct 2015Nothing published for this version
-
0.0.126 Sep 2015Nothing published for this version