#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

#279 in No standard library

Download history 35062/week @ 2024-09-24 35966/week @ 2024-10-01 29224/week @ 2024-10-08 47676/week @ 2024-10-15 43272/week @ 2024-10-22 48070/week @ 2024-10-29 38622/week @ 2024-11-05 37552/week @ 2024-11-12 48400/week @ 2024-11-19 49556/week @ 2024-11-26 54446/week @ 2024-12-03 56008/week @ 2024-12-10 48461/week @ 2024-12-17 20593/week @ 2024-12-24 30179/week @ 2024-12-31 46747/week @ 2025-01-07

156,597 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