pub fn concat<T, I>(elements: I) -> Vec<u8> ⓘwhere
T: AsRef<[u8]>,
I: IntoIterator<Item = T>,
Expand description
Concatenate the elements given by the iterator together into a single
Vec<u8>
.
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::concat(&["foo", "bar", "baz"]);
assert_eq!(s, "foobarbaz".as_bytes());