[][src]Crate tapir

A crate exposing the Tap trait, which makes method chaining easier.

Check out Tap for a more detailed documentation.

Examples

use tapir::Tap;

fn smallest_factor(x: u32) -> u32 {
    for i in 2..x {
        if x % i == 0 {
            return i;
        }
    }

    x
}

let smallest_factors: Vec<u32> = (2..25).map(smallest_factor).collect();

let unique_primes = smallest_factors.tap(|v| v.sort()).tap(Vec::dedup);
assert_eq!(unique_primes, [2, 3, 5, 7, 11, 13, 17, 19, 23]);

Traits

Tap

An interface to enable the tap operation which is implemented for all Sized types.