#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

#290 in No standard library

Download history 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 26092/week @ 2024-12-29 53315/week @ 2025-01-05 60492/week @ 2025-01-12 53934/week @ 2025-01-19 52132/week @ 2025-01-26 63235/week @ 2025-02-02 60092/week @ 2025-02-09 54600/week @ 2025-02-16 61433/week @ 2025-02-23 58605/week @ 2025-03-02

239,454 downloads per month
Used in 154 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