#iterator #chain #data-structures #no-alloc

no-std chain_from_last

Iterator adaptor for chaining from last item

2 unstable releases

0.2.0 Nov 15, 2024
0.1.0 Nov 15, 2024

#1612 in Algorithms

Download history 204/week @ 2024-11-12 32/week @ 2024-11-19

236 downloads per month

Apache-2.0

7KB
69 lines

Chain from last

An iterator adaptor that chains the iterator with an iterator built from the last item.

Example

use chain_from_last::ChainFromLastExt;

let words: Vec<_> = "lorem ipsum dolor;sit;amet"
    .split(" ")
    .chain_from_last(|l| l.split(";"))
    .collect();

assert_eq!(words, vec!["lorem", "ipsum", "dolor", "sit", "amet"]);

No runtime deps