Implements a wrapper over the primitive Rust types that better indicates overflow during arithmetic.
The struct Checked is actually a wrapper over an Option, so if x is a Checked object, then x.0 can be used like an Option.
``` extern crate checked use checked::Checked;
fn main() { let x = Checked::from(1000000000u32) * 3 + 2000000_000; match x.0 { Some(y) => println!("Didn't overflow: x is {}.", y), None => println!("The arithmetic overflowed."), } } ```
Note that Add\ This struct is based on std::num::Wrapping, except using checked arithmetic instead of wrapped arithmetic. I may try to add more features in time: make an Issue or Pull request to get the ball rolling.Contributing