scopefunc

Crates.ioscopefunc
lib.rsscopefunc
version0.1.1
sourcesrc
created_at2019-09-24 18:25:00.96437
updated_at2019-10-12 09:02:47.315335
descriptionA trait defining kotlin-like scope functions.
homepage
repositoryhttps://github.com/statiolake/scopefunc-rs
max_upload_size
id167346
size3,865
lake (statiolake)

documentation

README

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].
    
Commit count: 4

cargo fmt