pub fn join<B, T, I>(separator: B, elements: I) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
where
B: AsRef<[u8]>,
T: AsRef<[u8]>,
I: IntoIterator<Item = T>,
Expand description
Join the elements given by the iterator with the given separator into a
single Vec<u8>
.
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".as_bytes());