Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 85710a3 Oct 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benches
src
tests update for impl Trait stabilization Oct 2, 2018
.gitignore
.travis.yml
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md

README.md

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.
You can’t perform that action at this time.