pub(crate) fn local_relative_path(path: &Path) -> PathBuf {
    let mut rel_path = PathBuf::new();
    for component in path.components() {
        match component {
            Component::Prefix(_) | Component::RootDir | Component::CurDir => {}
            Component::ParentDir => drop(rel_path.pop()), // noop if empty
            Component::Normal(name) => rel_path.push(name),
        }
    }
    rel_path
}
// Given a path provided by the user, determines where generated files related
// to that path should go in our out dir. In particular we don't want to
// accidentally write generated code upward of our out dir, even if the user
// passed a path containing lots of `..` or an absolute path.
Given a path provided by the user, determines where generated files related
to that path should go in our out dir. In particular we don't want to
accidentally write generated code upward of our out dir, even if the user
passed a path containing lots of `..` or an absolute path.
Given a path provided by the user determines where generated files related to that path should go in our out dir . In particular we don ' t want to accidentally write generated code upward of our out dir even if the user passed a path containing lots of ` .. ` or an absolute path .
pub(crate) fn local_relative_path(path: &Path) -> PathBuf {
    let mut rel_path = PathBuf::new();
    for component in path.components() {
        match component {
            Component::Prefix(_) | Component::RootDir | Component::CurDir => {}
            Component::ParentDir => drop(rel_path.pop()), // noop if empty
            Component::Normal(name) => rel_path.push(name),
        }
    }
    rel_path
}
pub ( crate ) fn local_relative_path ( path : & Path ) -> PathBuf { let mut rel_path = PathBuf :: new ( ) ; for component in path . components ( ) { match component { Component :: Prefix ( _ ) | Component :: RootDir | Component :: CurDir => { } Component :: ParentDir => drop ( rel_path . pop ( ) ) , // noop if empty Component :: Normal ( name ) => rel_path . push ( name ) , } } rel_path }
Given a path provided by the user, determines where generated files related
to that path should go in our out dir.
Given a path provided by the user determines where generated files related to that path should go in our out dir .
path
&Path