path_cat

Macro path_cat 

Source
macro_rules! path_cat {
    (@stack $input:ident, $additional:ident; $($values_coerced:ident)*;) => { ... };
    (@stack $input:ident, $additional:ident; $($values_coerced:ident)*; $head:expr, $($tail:expr,)*) => { ... };
    ($input:expr; $($el:expr),+ $(,)?) => { ... };
    ($($el:expr),+ $(,)?) => { ... };
}
Expand description

Concatenate paths for a PathBuf.

It requires all elements to implement AsRef<Path>.

ยงExample

use str_cat::path_cat;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};

let mut s = path_cat!("Hello", "space".to_owned(), Path::new("World"), OsStr::new("bang"));
assert_eq!(s, ["Hello", "space", "World", "bang"].iter().collect::<PathBuf>());

// Reusing allocation.
s.clear();
path_cat!(&mut s; "foo", "bar");
assert_eq!(s, ["foo", "bar"].iter().collect::<PathBuf>());