Crates.io | newnum |
lib.rs | newnum |
version | 0.0.12 |
created_at | 2025-01-15 16:51:48.091723+00 |
updated_at | 2025-04-12 13:38:05.636652+00 |
description | traits for number API and hierarchy |
homepage | |
repository | https://github.com/Noam2Stein/newnum |
max_upload_size | |
id | 1517705 |
size | 52,346 |
The newnum
Rust crate is an alternative to the num
crate that splits the Rust number API and hierarchy into traits, with a cleaner design than num
.
The design of this crate follows these rules:
the Num
trait isn't restricted to primitives, or to types that can represent specific common values (0, 1...).
the Prim
, SignedPrim
, UnsignedPrim
, Int
, UInt
, SInt
, and Float
traits are restricted to primitives,
but allow non std
types to implement them as long as they follow primitive restrictions.
API traits (Round
, Root
, Trig
...) aren't restricted to Num
and are designed for non number support, for example <Angle as Trig>::Output = Ratio
.
The crate is already very usable but makes breaking changes every version to improve the design.