cargo_utils 0.1.78

Utilities around cargo and Rust workspaces
Documentation
1
2
3
4
5
6
7
8
9
10
use std::path::PathBuf;

use cargo_metadata::camino::Utf8PathBuf;

pub fn to_utf8_pathbuf(path: PathBuf) -> anyhow::Result<Utf8PathBuf> {
    match Utf8PathBuf::from_path_buf(path) {
        Ok(p) => Ok(p),
        Err(path) => Err(anyhow::anyhow!("cannot convert {:?} to Utf8Path", &path)),
    }
}