#functional

no-std tool

A grab-bag of tools for functional programming

7 releases

Uses old Rust 2015

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

#2060 in Rust patterns

Download history 37/week @ 2023-10-28 25/week @ 2023-11-04 28/week @ 2023-11-11 23/week @ 2023-11-18 42/week @ 2023-11-25 25/week @ 2023-12-02 25/week @ 2023-12-09 28/week @ 2023-12-16 34/week @ 2023-12-23 11/week @ 2023-12-30 19/week @ 2024-01-06 25/week @ 2024-01-13 25/week @ 2024-01-20 29/week @ 2024-01-27 11/week @ 2024-02-03 37/week @ 2024-02-10

105 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