Crates.io | steepen |
lib.rs | steepen |
version | |
source | src |
created_at | 2024-10-20 15:15:29.512669 |
updated_at | 2024-10-21 11:33:50.376652 |
description | Create multiple iterators from a single iterator by separating elements |
homepage | |
repository | https://codeberg.org/Fargeol/Steepen |
max_upload_size | |
id | 1416266 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
steepen
is a crate used to convert an iterator of elements into an iterator of blocks, given
that blocks can be created from an iterator of elements.
Does the contrary of the flatten
function, hence the name.
use steepen::Steepenable;
let iter = vec![("a", 1),("a", 2),("b", 1),("b", 2),("b", 1),("c", 2)].into_iter();
let mut result = iter
.steepen_by::<Vec<(&str, u32)>>(
// letters are different or numbers are descending
|x, y| x.0 != y.0 || x.1 > y.1
);
assert_eq!(result.next(), Some(vec![("a", 1),("a", 2)]));
assert_eq!(result.next(), Some(vec![("b", 1),("b", 2)]));
assert_eq!(result.next(), Some(vec![("b", 1)]));
assert_eq!(result.next(), Some(vec![("c", 2)]));
assert_eq!(result.next(), None);
iterators returned by a steepen
function respect four principles:
flatten
function reverses it