7 releases

Uses old Rust 2015

0.2.1 Oct 2, 2018
0.2.0 Sep 15, 2016
0.1.5 Sep 15, 2016

#2282 in Rust patterns

Download history 8/week @ 2024-04-14 10/week @ 2024-04-21 4/week @ 2024-04-28 6/week @ 2024-05-12 1/week @ 2024-05-19 14/week @ 2024-05-26 6/week @ 2024-06-02 2/week @ 2024-06-09 3/week @ 2024-06-16 1/week @ 2024-06-23 6/week @ 2024-07-14 3/week @ 2024-07-21 73/week @ 2024-07-28

82 downloads per month
Used in 2 crates (via sp-wasm-memfs)

MIT/Apache

20KB
465 lines

Tool

A grab-bag of useful functions for functional programming.

Example

Non-empty strings

extern crate tool;
use tool::prelude::*;
fn main() {
    let strings: Vec<_> = vec!["my string", "", "asdf", ""]
        .into_iter()
        .filter(non_empty)
        .collect();
    assert_eq!(strings, vec!["my string", "asdf"]);
}

First item in an iterator of tuples.

extern crate tool;
use tool::prelude::*;
fn main() {
    let strings: Vec<_> = vec![("first", 1), ("second", 2), ("third", 3), ("fourth", 4)]
        .into_iter()
        .map(first)
        .collect();

    assert_eq!(strings, vec!["first", "second", "third", "fourth"]);
}

Compile-Time Flags (cargo features)

  • use_std (default: enabled) - Disable this if you're project doesn't depend on libstd.

No runtime deps

Features