| Crates.io | safe_arith |
| lib.rs | safe_arith |
| version | 0.1.0 |
| created_at | 2025-10-12 10:16:02.931516+00 |
| updated_at | 2025-10-12 10:16:02.931516+00 |
| description | Safe arithmetic on integers, which avoids overflow and division by zero. |
| homepage | |
| repository | https://github.com/sigp/safe_arith |
| max_upload_size | |
| id | 1879139 |
| size | 12,734 |
Safe arithmetic on integers, avoiding overflow and division by zero.
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:
Result<T, ArithError> with explicit Overflow and DivisionByZero variantssafe_add_assign that mutate in placesafe_sum() method for safely summing iterators without overflow