fn canonicalize(&self, symbolic_path: PathBuf, link: Link) -> BoxFuture<Option<PathStat>, E> {
    // Read the link, which may result in PathGlob(s) that match 0 or 1 Path.
    let context = self.clone();
    self
      .read_link(link)
      .map(|dest_path| {
        // If the link destination can't be parsed as PathGlob(s), it is broken.
        dest_path
          .to_str()
          .and_then(|dest_str| {
            // Escape any globs in the parsed dest, which should guarantee one output PathGlob.
            PathGlob::create(&[Pattern::escape(dest_str)]).ok()
          })
          .unwrap_or_else(|| vec![])
      })
      .and_then(move |link_globs| context.expand(PathGlobs::from_globs(link_globs)))
      .map(|mut path_stats| {
        // Since we've escaped any globs in the parsed path, expect either 0 or 1 destination.
        path_stats.pop().map(|ps| match ps {
          PathStat::Dir { stat, .. } => PathStat::dir(symbolic_path, stat),
          PathStat::File { stat, .. } => PathStat::file(symbolic_path, stat),
        })
      })
      .to_boxed()
  }
///
/// Canonicalize the Link for the given Path to an underlying File or Dir. May result
/// in None if the PathStat represents a broken Link.
///
/// Skips ignored paths both before and after expansion.
///
/// TODO: Should handle symlink loops (which would exhibit as an infinite loop in expand).
///
Canonicalize the Link for the given Path to an underlying File or Dir. May result
in None if the PathStat represents a broken Link.

Skips ignored paths both before and after expansion.

Should handle symlink loops (which would exhibit as an infinite loop in expand).
Canonicalize the Link for the given Path to an underlying File or Dir . May result in None if the PathStat represents a broken Link . Skips ignored paths both before and after expansion . Should handle symlink loops ( which would exhibit as an infinite loop in expand ) .
fn canonicalize(&self, symbolic_path: PathBuf, link: Link) -> BoxFuture<Option<PathStat>, E> {
    // Read the link, which may result in PathGlob(s) that match 0 or 1 Path.
    let context = self.clone();
    self
      .read_link(link)
      .map(|dest_path| {
        // If the link destination can't be parsed as PathGlob(s), it is broken.
        dest_path
          .to_str()
          .and_then(|dest_str| {
            // Escape any globs in the parsed dest, which should guarantee one output PathGlob.
            PathGlob::create(&[Pattern::escape(dest_str)]).ok()
          })
          .unwrap_or_else(|| vec![])
      })
      .and_then(move |link_globs| context.expand(PathGlobs::from_globs(link_globs)))
      .map(|mut path_stats| {
        // Since we've escaped any globs in the parsed path, expect either 0 or 1 destination.
        path_stats.pop().map(|ps| match ps {
          PathStat::Dir { stat, .. } => PathStat::dir(symbolic_path, stat),
          PathStat::File { stat, .. } => PathStat::file(symbolic_path, stat),
        })
      })
      .to_boxed()
  }
fn canonicalize ( & self , symbolic_path : PathBuf , link : Link ) -> BoxFuture < Option < PathStat > , E > { // Read the link, which may result in PathGlob(s) that match 0 or 1 Path. let context = self . clone ( ) ; self . read_link ( link ) . map ( | dest_path | { // If the link destination can't be parsed as PathGlob(s), it is broken. dest_path . to_str ( ) . and_then ( | dest_str | { // Escape any globs in the parsed dest, which should guarantee one output PathGlob. PathGlob :: create ( & [ Pattern :: escape ( dest_str ) ] ) . ok ( ) } ) . unwrap_or_else ( | | vec ! [ ] ) } ) . and_then ( move | link_globs | context . expand ( PathGlobs :: from_globs ( link_globs ) ) ) . map ( | mut path_stats | { // Since we've escaped any globs in the parsed path, expect either 0 or 1 destination. path_stats . pop ( ) . map ( | ps | match ps { PathStat :: Dir { stat , .. } => PathStat :: dir ( symbolic_path , stat ) , PathStat :: File { stat , .. } => PathStat :: file ( symbolic_path , stat ) , } ) } ) . to_boxed ( ) }
Canonicalize the Link for the given Path to an underlying File or Dir.
Canonicalize the Link for the given Path to an underlying File or Dir .
&self
symbolic_path
PathBuf
link
Link
&self
symbolic_path
PathBuf
link
Link