Skip to content

kamadak/checked_ops-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)

Usage
-----

   Add a dependency entry to your Cargo.toml.

      [dependencies]
      checked_ops = "0.1"

   Import the macro into your source code.

      use checked_ops::checked_ops;

   Use the macro.

      checked_ops!((a + b) * c)

Dependencies
------------

   Rust 1.34 or later is required.

About

Automatic checked arithmetic operations in Rust

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages