proxmox-backup/pbs-tools/src/str.rs
Wolfgang Bumiller 770a36e53a add pbs-tools subcrate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-06 15:10:37 +02:00

18 lines
303 B
Rust

//! String related utilities.
use std::borrow::Borrow;
pub fn join<S: Borrow<str>>(data: &[S], sep: char) -> String {
let mut list = String::new();
for item in data {
if !list.is_empty() {
list.push(sep);
}
list.push_str(item.borrow());
}
list
}