#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

#257 in No standard library

Download history 35931/week @ 2024-07-22 38184/week @ 2024-07-29 36645/week @ 2024-08-05 37139/week @ 2024-08-12 35633/week @ 2024-08-19 36535/week @ 2024-08-26 37205/week @ 2024-09-02 33534/week @ 2024-09-09 32470/week @ 2024-09-16 36316/week @ 2024-09-23 37100/week @ 2024-09-30 28460/week @ 2024-10-07 45786/week @ 2024-10-14 43933/week @ 2024-10-21 47117/week @ 2024-10-28 40766/week @ 2024-11-04

179,755 downloads per month
Used in 143 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