saturating_add_assign

Crates.iosaturating_add_assign
lib.rssaturating_add_assign
version1.0.0
sourcesrc
created_at2024-11-21 11:27:40.649297
updated_at2024-11-21 11:27:40.649297
descriptionConvenience macro for AddAssign with saturating arithmetic.
homepage
repositoryhttps://github.com/kevinheavey/saturating_add_assign
max_upload_size
id1456045
size4,545
Kevin Heavey (kevinheavey)

documentation

https://docs.rs/saturating_add_assign

README

saturating_add_assign

This crate contains the saturating_add_assign macro, which looks like this:

macro_rules! saturating_add_assign {
    ($i:expr, $v:expr) => {{
        $i = $i.saturating_add($v)
    }};
}

There is nothing else in here and there never will be. This crate exists because the Agave repo uses this macro everywhere and I wanted to rip it out without heavy dependencies. You should probably only use this crate if you were already using the original saturating_add_assign macro.

You should pin the version to 1.0.0 in your Cargo.toml file, because there isn't a clear reason why the four lines of code should ever change, and if there is a new release it could mean I got hacked.

[dependencies]
saturating_add_assign = "=1.0.0"
Commit count: 0

cargo fmt