dirge
Examples
Absolute paths are just paths
use ;
use Path;
let a: AbsPathBuf = example;
let b: &AbsPath = &a;
let c: &Path = &a;
let d: &Path = &b;
/// Precondition enforced by type system
/// But they go anywhere the standard library's paths do!
let _ = read_to_string;
Relative paths provide similar guarantees
use ;
use Path;
let rel = new.unwrap;
let rel_ref: &RelPath = &rel;
let path_ref: &Path = &rel;
/// Type system enforces relative path requirement
needs_relative_path;
Normalized paths remove redundant components
use ;
use Path;
let norm = new.unwrap;
assert_eq!;
let norm_ref: &NormPath = &norm;
let path_ref: &Path = &norm;
/// Type system guarantees normalized paths
needs_normalized_path;
Background
This crate provides portable extensions to the standard library's path functionality. Our types have specific usages while incurring no storage overhead. For example, [AbsPathBuf] and [std::path::PathBuf] have identical in-memory representations, but the former is guaranteed to be an absolute path.
This crate has several goals:
- Enhance correctness through specific types.
- Be conducive to re-exporting.
- Be portable.
License: Unlicense/MIT