Padding and separation extensions to iterators



iterext: A few more extension methods on iterators.

This crate is not likely to ever be published on because it's far more appropriate to attepmt to get these extensions added to itertools. However, I haven't yet made the time to attempt to contribute them there.

A few quick examples from the tests should show what it's about:

use iterext::prelude::*;

fn test_separate() {
    for (msg, expect) in &[
        ("abc", "abc"),
        ("zyx", "zyx"),
            "abcde fghij klmno pqrst uvwxy z",
            "thequ ickbr ownfo xjump edove rthel azydo g",
            "abcde fghij klmno pqrst uvwxy zabcd efghi jklmn opqrs tuvwx yz",
    ] {
        let got: String = msg.chars().separate(' ', 5);
        assert_eq!(&got, expect,);

fn test_padding_chars() {
    let have = "foo".chars().pad('X', 5).collect::<String>();
    assert_eq!(have, "fooXX");


Originally wrote these extensions as part of the textbyte module for my solitaire implementation.