# safe_arith
[](https://github.com/sigp/safe_arith/actions)
[](https://crates.io/crates/safe_arith)
[](https://docs.rs/safe_arith)
Safe arithmetic on integers, avoiding overflow and division by zero.
## Why not just use `checked_*` methods?
Rust's built-in `checked_add`, `checked_mul`, etc. return `Option<T>`, which requires you to manually
handle `None` cases without context about what went wrong. This crate provides:
1. **Explicit errors**: Returns `Result<T, ArithError>` with explicit `Overflow` and `DivisionByZero` variants
2. **Assignment operators**: Methods like `safe_add_assign` that mutate in place
3. **Iterator support**: `safe_sum()` method for safely summing iterators without overflow