Trait joinery::join::Separator[][src]

pub trait Separator: Sized {
    fn separate<T: Joinable>(self, collection: T) -> Join<T::Collection, Self> { ... }
}
Expand description

A trait for using a separator to produce a Join.

This trait provides a more python-style interface for performing joins. Rather use collection.join_with, you can instead use:

use joinery::Separator;

let join = ", ".separate([1, 2, 3, 4]);
assert_eq!(join.to_string(), "1, 2, 3, 4");

By default, Separator is implemented for char and &str, as well as all the separator types in separators.

Note that any type can be used as a separator in a Join when creating one via Joinable::join_with. The Separator trait and its implementations on char and &str are provided simply as a convenience.

Provided methods

fn separate<T: Joinable>(self, collection: T) -> Join<T::Collection, Self>[src]

Implementations on Foreign Types

impl Separator for char[src]

impl<'a> Separator for &'a str[src]

Implementors