pub fn canonicalize_parent(path: impl AsRef<Path>) -> FailResult<PathBuf>
{
    let path = path.as_ref();
    if path.exists() {
        return canonicalize(path);
    }
    match split(path) {
        None => Ok(path.into()),
        Some((parent, name)) => {
            canonicalize(parent).map(|p| p.join(name))
        },
    }
}
/// Canonicalizes a path where the final component need not exist.
///
/// NOTE: will behave strangely for paths that end in ..
///       due to how Path::parent is defined
Canonicalizes a path where the final component need not exist.
NOTE: will behave strangely for paths that end in
due to how Path::parent is defined
Canonicalizes a path where the final component need not exist . NOTE : will behave strangely for paths that end in due to how Path :: parent is defined
pub fn canonicalize_parent(path: impl AsRef<Path>) -> FailResult<PathBuf>
{
    let path = path.as_ref();
    if path.exists() {
        return canonicalize(path);
    }
    match split(path) {
        None => Ok(path.into()),
        Some((parent, name)) => {
            canonicalize(parent).map(|p| p.join(name))
        },
    }
}
pub fn canonicalize_parent ( path : impl AsRef < Path > ) -> FailResult < PathBuf > { let path = path . as_ref ( ) ; if path . exists ( ) { return canonicalize ( path ) ; } match split ( path ) { None => Ok ( path . into ( ) ) , Some ( ( parent , name ) ) => { canonicalize ( parent ) . map ( | p | p . join ( name ) ) } , } }
Canonicalizes a path where the final component need not exist.
Canonicalizes a path where the final component need not exist .
path
impl AsRef<Path>
path
impl AsRef<Path>