2 releases
0.1.1 | Oct 12, 2019 |
---|---|
0.1.0 | Sep 24, 2019 |
#2828 in Rust patterns
3KB
scopefunc - use kotlin-like scope functions
Add trait defining kotlin-like scope functions.
Currently provided functions are:
-
transform()
: transform value to another.let v = gen_rand(0, 10).transform(|v| 'x'.repeat(v)); // => `v` is random length of "xx...".
-
modify()
: modify the value and return.let v = vec![1, 2, 3].modify(|v| v.push(4)); // => `v` is [1, 2, 3, 4].