#numerics #mathematics

no-std saturating

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

1 unstable release

0.1.0 Jul 18, 2019

#62 in #numerics

Download history 18804/week @ 2022-08-05 23533/week @ 2022-08-12 21804/week @ 2022-08-19 24164/week @ 2022-08-26 21938/week @ 2022-09-02 26030/week @ 2022-09-09 28793/week @ 2022-09-16 30753/week @ 2022-09-23 21971/week @ 2022-09-30 30459/week @ 2022-10-07 31411/week @ 2022-10-14 30344/week @ 2022-10-21 29807/week @ 2022-10-28 24409/week @ 2022-11-04 26198/week @ 2022-11-11 21491/week @ 2022-11-18

108,689 downloads per month
Used in 58 crates (via mysql_common)

MIT license

7KB
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