Skip to content

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

License

Notifications You must be signed in to change notification settings

Lut99/transform-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transform-rs

A small Rust library that defined the TransformIter-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.2.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 now licensed under Apache 2.0. 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 ;)

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages