• Javier Honduvilla Coto's avatar
    Allow arbitrary hashtable increments. Fixes #1742 (#1897) · 230c9c00
    Javier Honduvilla Coto authored
    * Allow arbitrary hashtable increments. Fixes #1742
    
    Right now incrementing some datastructure's values like maps or histograms can
    be done with some boilerplate[1] or with `increment` which increments a value
    by 1.
    
    This patch allows a second optional parameter to use as the increment.
    
    - [1]:
    ```
    u64 zero = 0, *val;
    val = map.lookup_or_init(&key, &zero);
    (*val) += inc;
    ```
    
    Notes:
    - Some lines in the documentation where changed because of trailing spaces
    deletion
    - The test is quite simple right now
    - Will update the tools to use `increment` in another PR
    
    * CR changes
    230c9c00
tutorial.md 18.8 KB