joinery
A Rust library for generically joining iterables with a separator. Provides the tragically missing string join functionality to rust.
extern crate joinery;
use env;
// Or use joinery::prelude::*;
use Joinable;
Installation
Add joinery to your Cargo.toml:
[]
= "0.1.0"
Nightly-only features
If you're using nightly rust, add the features to support nightly-only optimizations:
[]
= "0.1.0"
= ["trusted_len", "try_fold"]
Overview
Joinery provides joins over iterators. Put simply, a join is a combination of an iterator and a separator. The join then conceptually represents all the elemetns of the iterator, with the separator between each one.
Joins implement the Display trait, so they can be printed to writers or coverted to Strings. They can also be iterated over, and use the JoinItem enum to distinguish iterator elements from the separators.
See the docs for complete documentation, including many more examples.