[][src]Function bstr::join

pub fn join<B, T, I>(separator: B, elements: I) -> BString where
    B: AsRef<[u8]>,
    T: AsRef<[u8]>,
    I: IntoIterator<Item = T>, 

Join the elements given by the iterator with the given separator into a single BString.

Both the separator and the elements may be any type that can be cheaply converted into an &[u8]. This includes, but is not limited to, &str, &BStr and &[u8] itself.

Examples

Basic usage:

use bstr;

let s = bstr::join(",", &["foo", "bar", "baz"]);
assert_eq!(s, "foo,bar,baz");