pathbuf-ext 0.1.0

Extends PathBuf to handle `replace` and `contains` string methods
Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 5.67 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.12 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • zitrussaft1/pathbuf-ext
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zitrussaft

Extended PathBuf

Here are some examples on how to use it:

let path = Path::new("C:\\Users\\user\\Desktop\\test.txt");
let path = path.replace("user/Desktop", "user/Documents");
assert_eq!(path, PathBuf::from("C:\\Users\\user\\Documents\\test.txt"));
let path = Path::new("C:\\Users\\user\\Desktop\\test.txt");
assert!(path.contains("Desktop"));
assert!(!path.contains("Documents"));

// Windows
assert!(path.contains("user\\Desktop"));
assert!(!path.contains("user\\Documents"));

// Linux
assert!(path.contains("user/Desktop"));
assert!(!path.contains("user/Documents"));