Trait joinery::Separator [−][src]
pub trait Separator { fn separate<T: Joinable>(self, iter: T) -> Join<T::IntoIter, Self>
where
Self: Sized, { ... } }
A trait for using a separator to produce a Join
.
This trait provides a more python-style interface for performing joins.
Rather than do collection.join_with
, you do:
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
.
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
Implementations on Foreign Types
impl<'a> Separator for &'a str
[src]
impl<'a> Separator for &'a str
impl Separator for char
[src]
impl Separator for char