Skip to content

Commit

Permalink
Export IntoAnchor and annotate Anchor.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 8, 2023
1 parent 1e31310 commit b4b1ffd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/walk/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ impl<'t> Glob<'t> {
}
}

#[cfg_attr(docsrs, doc(cfg(feature = "walk")))]
pub trait IntoAnchor {
fn into_anchor<'t>(self, glob: &Glob<'t>) -> Anchor;
fn into_anchor(self, glob: &Glob<'_>) -> Anchor;
}

impl IntoAnchor for Anchor {
fn into_anchor<'t>(self, _: &Glob<'t>) -> Anchor {
fn into_anchor(self, _: &Glob<'_>) -> Anchor {
self
}
}
Expand All @@ -292,12 +293,13 @@ impl<P> IntoAnchor for P
where
P: Into<PathBuf>,
{
fn into_anchor<'t>(self, glob: &Glob<'t>) -> Anchor {
fn into_anchor(self, glob: &Glob<'_>) -> Anchor {
glob.anchor(self)
}
}

#[derive(Clone, Debug)]
#[cfg_attr(docsrs, doc(cfg(feature = "walk")))]
#[derive(Clone, Debug, Hash, PartialEq)]
pub struct Anchor {
root: PathBuf,
prefix: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion src/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::walk::filter::{
use crate::walk::glob::FilterAny;
use crate::{BuildError, Combine};

pub use crate::walk::glob::{Anchor, GlobEntry};
pub use crate::walk::glob::{Anchor, GlobEntry, IntoAnchor};

pub type FileFiltrate<T> = Result<T, WalkError>;
pub type FileResidue = TreeResidue<TreeEntry>;
Expand Down

0 comments on commit b4b1ffd

Please sign in to comment.