Expand description
Pure functions for cross-platform path normalization
This module provides path normalization utilities for matching coverage data across different platforms and environments. All functions are pure (no I/O) and designed for composition.
§Architecture
Path normalization follows a functional pipeline:
- Component extraction - break paths into meaningful segments
- Separator normalization - convert all separators to forward slash
- Suffix matching - match paths based on meaningful components
§Example
use std::path::Path;
use debtmap::risk::path_normalization::{normalize_path_components, paths_match_by_suffix};
let query = Path::new("src/lib.rs");
let target = Path::new("/home/user/project/src/lib.rs");
let query_components = normalize_path_components(query);
let target_components = normalize_path_components(target);
assert!(paths_match_by_suffix(&query_components, &target_components));Structs§
- Normalized
Path - Result of path normalization with diagnostic info
Enums§
- Match
Strategy - Strategy used to match a path
Functions§
- find_
matching_ path - Pure function: Find best matching path from available paths
- normalize_
path_ components - Pure function: Extract meaningful path components
- normalize_
path_ separators - Pure function: Normalize path separators to forward slash
- paths_
match_ by_ suffix - Pure function: Check if query path matches target by suffix