1 unstable release

0.1.0 Mar 13, 2020

#28 in #ops

Download history 215/week @ 2024-11-15 142/week @ 2024-11-22 85/week @ 2024-11-29 89/week @ 2024-12-06 182/week @ 2024-12-13 78/week @ 2024-12-20 78/week @ 2024-12-27 286/week @ 2025-01-03 196/week @ 2025-01-10 141/week @ 2025-01-17 149/week @ 2025-01-24 171/week @ 2025-01-31 210/week @ 2025-02-07 57/week @ 2025-02-14 69/week @ 2025-02-21 353/week @ 2025-02-28

727 downloads per month

BSD-2-Clause

15KB
182 lines

Automatic checked arithmetic operations in Rust

Are you tired of writing checked arithmetic operations like this?

  a.checked_add(b).and_then(|t| t.checked_mul(c))

The checked_ops crate to the rescue.

  checked_ops!((a + b) * c)

lib.rs:

Automatic checked arithmetic operations in Rust.

The checked_ops macro takes an expression and expands it into a checked form. You no longer need to type:

a.checked_add(b).and_then(|t| t.checked_mul(c))

You can just do:

checked_ops!((a + b) * c)

The current implementation has several limitations. See the documentation of checked_ops macro for details.

Dependencies

~150KB