#math #numeric

no-std saturating

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

1 unstable release

0.1.0 Jul 18, 2019

#238 in No standard library

Download history 35631/week @ 2024-03-06 38432/week @ 2024-03-13 45631/week @ 2024-03-20 33935/week @ 2024-03-27 44933/week @ 2024-04-03 41086/week @ 2024-04-10 33257/week @ 2024-04-17 46179/week @ 2024-04-24 39680/week @ 2024-05-01 40007/week @ 2024-05-08 34351/week @ 2024-05-15 36399/week @ 2024-05-22 38986/week @ 2024-05-29 33772/week @ 2024-06-05 37828/week @ 2024-06-12 29498/week @ 2024-06-19

146,745 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