#math #numeric

no-std saturating

Provides Saturating<T>, an intentionally-saturating arithmetic wrapper

1 unstable release

0.1.0 Jul 18, 2019

#248 in No standard library

Download history 41416/week @ 2024-03-14 43971/week @ 2024-03-21 35733/week @ 2024-03-28 45081/week @ 2024-04-04 37612/week @ 2024-04-11 37250/week @ 2024-04-18 42691/week @ 2024-04-25 40176/week @ 2024-05-02 39589/week @ 2024-05-09 34273/week @ 2024-05-16 36050/week @ 2024-05-23 39443/week @ 2024-05-30 33672/week @ 2024-06-06 37792/week @ 2024-06-13 35807/week @ 2024-06-20 28299/week @ 2024-06-27

142,170 downloads per month
Used in 131 crates (2 directly)

MIT license

8KB
140 lines

saturating-rs

Build Status

Saturating<T> is an intentionally-saturating arithmetic wrapper, similar to std::num::Wrapping.

Examples

use saturating::Saturating;

let foo = Saturating(253u8);
let bar = Saturating(100u8);

assert_eq!(std::u8::MAX, (foo + bar).0);

lib.rs:

Provides Saturating<T>, an intentionally-saturating arithmetic wrapper, similar to std::num::Wrapping.

Examples

use saturating::Saturating;

let foo = Saturating(253u8);
let bar = Saturating(100u8);

assert_eq!(std::u8::MAX, (foo + bar).0);

No runtime deps