1 unstable release

0.1.0 Feb 23, 2021

#6 in #separation

Download history 32/week @ 2024-07-22 43/week @ 2024-07-29 32/week @ 2024-08-05 39/week @ 2024-08-12 24/week @ 2024-08-19 44/week @ 2024-08-26 22/week @ 2024-09-02 48/week @ 2024-09-09 23/week @ 2024-09-16 51/week @ 2024-09-23 29/week @ 2024-09-30 10/week @ 2024-10-07 31/week @ 2024-10-14 19/week @ 2024-10-21 25/week @ 2024-10-28 16/week @ 2024-11-04

91 downloads per month
Used in 3 crates (via num-runtime-fmt)

MIT license

8KB
151 lines

iterext: A few more extension methods on iterators.

This crate is not likely to ever be published on https://crates.io 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::*;

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

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

Provenance

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

Dependencies

~425KB