closure-it

Crates.ioclosure-it
lib.rsclosure-it
version0.1.5
created_at2025-04-20 03:54:57.349426+00
updated_at2025-04-21 12:29:02.363978+00
descriptionLike kotlin it keyword, translate `it` to closure
homepage
repositoryhttps://github.com/A4-Tacks/closure-it-rs
max_upload_size
id1641360
size9,512
A4-Tacks (A4-Tacks)

documentation

README

Like kotlin it keyword, translate it to closure

Examples

#[closure_it::closure_it]
fn main() {
    assert_eq!([0i32, 1, 2].map(it+2), [2, 3, 4]);
    assert_eq!([0i32, -1, 2].map(it.abs()), [0, 1, 2]);
    assert_eq!(Some(2).map_or(3, it*2), 4);
}
#[closure_it::closure_it(this)]
fn main() {
    assert_eq!([0i32, 1, 2].map(this+2), [2, 3, 4]);
    assert_eq!([0i32, -1, 2].map(this.abs()), [0, 1, 2]);
    assert_eq!(Some(2).map_or(3, this*2), 4);
}
Commit count: 7

cargo fmt