#math #numeric

no-std saturating

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

1 unstable release

0.1.0 Jul 18, 2019

#220 in No standard library

Download history 39286/week @ 2024-01-10 49137/week @ 2024-01-17 38165/week @ 2024-01-24 44811/week @ 2024-01-31 50091/week @ 2024-02-07 34298/week @ 2024-02-14 33072/week @ 2024-02-21 35026/week @ 2024-02-28 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 39109/week @ 2024-04-24

164,750 downloads per month
Used in 130 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