I have function that return Vec<PathBuf> and function that accept &[&Path], basically like this:
use std::path::{Path, PathBuf};
fn f(paths: &[&Path]) {
}
fn main() {
let a: Vec<PathBuf> = vec![PathBuf::from("/tmp/a.txt"), PathBuf::from("/tmp/b.txt")];
f(&a[..]);
}
Is it possible to convert Vec<PathBuf> to &[&Path] without memory allocations?
If not, how should I change f signature to accept slices with Path and PathBuf?