#arith

arith

containers with arithmetics

5 releases

0.2.3 May 16, 2021
0.2.2 May 16, 2021
0.2.1 May 16, 2021
0.2.0 May 16, 2021
0.1.0 Apr 15, 2021

#1379 in Data structures

Download history 7/week @ 2025-01-14 1/week @ 2025-01-21 1/week @ 2025-02-04 47/week @ 2025-02-11 25/week @ 2025-02-18 32/week @ 2025-02-25 11/week @ 2025-03-04 36/week @ 2025-03-11 11/week @ 2025-03-18 43/week @ 2025-03-25 27/week @ 2025-04-01

117 downloads per month

GPL-3.0 license

10KB
178 lines

arith

Containers with arithmetic operations support.

Usage

arithmap!{"a" => 1, "b" => 2} + 1 == arithmap!{"a" => 2, "b" => 3};
arithmap!{"a" => 1, "b" => 2} + arithmap!{"b" => 2, "c" => 3} == arithmap!{"a" => 1, "b" => 4, "c" => 3};
(arithmap!{"a" => 0, "b" => 1}.prune()) == arithmap!{"b" => 1};

You can access underlying values with .hashmap field. For now only &'a str keys are supported, until I convince the borrow checker to let me use a generic key type.

Documentation

Copyright (C) 2021- Piotr Oleśkiewicz

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

No runtime deps