#math #wrapper #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

#229 in No standard library

Download history 35848/week @ 2023-11-20 38858/week @ 2023-11-27 39287/week @ 2023-12-04 39398/week @ 2023-12-11 43141/week @ 2023-12-18 25850/week @ 2023-12-25 33952/week @ 2024-01-01 40589/week @ 2024-01-08 43990/week @ 2024-01-15 41740/week @ 2024-01-22 47198/week @ 2024-01-29 43574/week @ 2024-02-05 41378/week @ 2024-02-12 32603/week @ 2024-02-19 34721/week @ 2024-02-26 35705/week @ 2024-03-04

145,713 downloads per month
Used in 125 crates (via mysql_common)

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