leesiongchan / callbag.rs

An experiment of the callbag spec in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

callbag.rs 👜

Experimental callbag implementation in Rust 🦀! Currently attempting to implement some of the core basics (see the list below for progress).

pipe!(
    from_iter(0..10),
    map(|x| x * 3),
    filter(|x| x % 2 == 0),
    map(|x| format!("The number is {}", x)),
    for_each(|x| println!("{}", x))
);

Testing

Run tests with cargo test -- --nocapture to see output.

API

The list below shows what's currently implemented/being attempted.

Source factories

  • from_iter
  • interval

Sink factories

  • for_each

Transformation operators

  • map
  • scan
  • flatten

Filtering operators

  • take
  • take_until
  • take_while
  • take_until_interval
  • skip
  • skip_until
  • skip_while
  • filter

Combination operators

  • merge - variadic with macro merge!
  • concat
  • combine - tough one, need to flatten tuples

Utilities

  • pipe - variadic with macro pipe!

About

An experiment of the callbag spec in Rust


Languages

Language:Rust 100.0%