Crate transform

Source
Expand description

A small Rust library that defined the Transform iterator, which can map an element in a tuple to zero or more elements of a potentially different type.

§Installation

To install the transform-crate, simply add it to your Cargo.toml file:

transform = { git = "https://github.com/Lut99/transform-rs" }

You can also commit yourself to a particular version by using the tag-key.

transform = { git = "https://github.com/Lut99/transform-rs", tag = "v0.1.0" }

§Usage

To use this library, first add the Transform-trait to your current scope:

use transform::Transform as _;
// Or, if preferred:
use transform::prelude::*;
   
// ...

Next, you can call transform() on iterator functions to do things like content-based expansion:

let numbers = vec![1, 2, 3, 4, 5];
let numbers: Vec<i32> = numbers.into_iter().transform(|num| vec![num; num as usize]).collect();
assert_eq!(numbers, vec![1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]);

§Features

This crate does not have any features.

§License

This project is licensed under GPLv3. See LICENSE for more information.

§Contributing

If you want to contribute to this create, welcome! Feel free to raise an issue or create a pull request.

Note, however, that this is a hobby project. As such, I might not adopt all suggestions, no matter how good they are ;)

Modules§

Structs§

  • An iterator that applies a closure that can transform an element in the existing iterator into zero or more elements in the resulting iterator.

Traits§