Crates.io | scopefunc |
lib.rs | scopefunc |
version | 0.1.1 |
source | src |
created_at | 2019-09-24 18:25:00.96437 |
updated_at | 2019-10-12 09:02:47.315335 |
description | A trait defining kotlin-like scope functions. |
homepage | |
repository | https://github.com/statiolake/scopefunc-rs |
max_upload_size | |
id | 167346 |
size | 3,865 |
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].