Skip to content

Commit

Permalink
Add table to root_relative_paths documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 17, 2023
1 parent 898ff38 commit 3f02a9b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,19 @@ pub trait Entry {
/// The root path is the path to the walked directory from which the file entry has been read.
/// The relative path is the remainder of the file path of the entry (the path relative to the
/// root directory). The relative path may be empty.
///
/// The root and relative paths can differ significantly depending on the way a directory is
/// walked, in particular when using a [`Glob`]. The following table describes some example
/// paths when using [`Glob::walk`].
///
/// | Glob Expression | Directory | Path | Root | Relative |
/// |---------------------------|--------------|------------------------------------|--------------|----------------------------------|
/// | `**/*.txt` | `/home/user` | `/home/user/notes.txt` | `/home/user` | `notes.txt` |
/// | `projects/**/src/**/*.rs` | `.` | `./projects/fibonacci/src/main.rs` | `.` | `projects/fibonacci/src/main.rs` |
/// | `/var/log/**/*.log` | `.` | `/var/log/pacman.log` | | `/var/log/pacman.log` |
///
/// [`Glob`]: crate::Glob
/// [`Glob::walk`]: crate::Glob::walk
fn root_relative_paths(&self) -> (&Path, &Path);

/// Gets the [`Metadata`] of the file.
Expand Down Expand Up @@ -655,8 +668,6 @@ pub trait FileIterator:
/// combinator does not read conventionally hidden directory trees.
///
/// ```rust,no_run
/// #[cfg(windows)]
/// use wax::walk::EntryResidue;
/// use wax::walk::{Entry, FileIterator};
/// use wax::Glob;
///
Expand All @@ -670,6 +681,7 @@ pub trait FileIterator:
/// #[cfg(windows)]
/// let walk = walk.filter_entry(|entry| {
/// use std::os::windows::fs::MetadataExt as _;
/// use wax::walk::EntryResidue;
///
/// const ATTRIBUTE_HIDDEN: u32 = 0x2;
///
Expand Down

0 comments on commit 3f02a9b

Please sign in to comment.