Collect file paths only (no data)
(dir: &Path, base: &Path)
| 38 | pub struct CompiledPathPattern { |
| 39 | segments: Box<[Box<str>]>, |
| 40 | } |
| 41 | |
| 42 | impl CompiledPathPattern { |
| 43 | pub fn new(pattern: &str) -> Self { |
| 44 | Self { |
| 45 | segments: pattern.split('/').map(Box::from).collect(), |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /// Match against a path already split into `/` segments |
| 50 | /// (see [`split_path_segments`]). |
| 51 | pub fn matches_segments(&self, path: &[&str]) -> bool { |
| 52 | match_segments(&self.segments, path) |
| 53 | } |
| 54 | |
| 55 | pub fn matches_path(&self, path: &str) -> bool { |
| 56 | self.matches_segments(&path.split('/').collect::<Vec<_>>()) |
| 57 | } |
no test coverage detected