Get the depth of a path. # Arguments `path` - Path to measure # Returns Number of path components (0 for empty path). # Example ```rust use atomic_core::output::repo::TreeCollectOptions; assert_eq!(TreeCollectOptions::path_depth(""), 0); assert_eq!(TreeCollectOptions::path_depth("file.txt"), 1); assert_eq!(TreeCollectOptions::path_depth("src/main.rs"), 2); assert_eq!(TreeCollectOptions::pat
(path: &str)
| 403 | /// assert_eq!(TreeCollectOptions::path_depth("a/b/c/d.rs"), 4); |
| 404 | /// ``` |
| 405 | pub fn path_depth(path: &str) -> usize { |
| 406 | if path.is_empty() { |
| 407 | 0 |
| 408 | } else { |
| 409 | path.split('/').filter(|s| !s.is_empty()).count() |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | /// Check if a path exceeds the maximum depth. |
| 414 | /// |