#math #numeric #saturating-t #intentionally-saturating

no-std saturating

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

1 unstable release

0.1.0 Jul 18, 2019

#273 in No standard library

Download history 35975/week @ 2024-09-22 36725/week @ 2024-09-29 28773/week @ 2024-10-06 45897/week @ 2024-10-13 44016/week @ 2024-10-20 47025/week @ 2024-10-27 40563/week @ 2024-11-03 37614/week @ 2024-11-10 46153/week @ 2024-11-17 45808/week @ 2024-11-24 55609/week @ 2024-12-01 56465/week @ 2024-12-08 53284/week @ 2024-12-15 22131/week @ 2024-12-22 26630/week @ 2024-12-29 50942/week @ 2025-01-05

155,769 downloads per month
Used in 150 crates (3 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