| Crates.io | pathext |
| lib.rs | pathext |
| version | 0.2.1 |
| created_at | 2022-01-03 21:27:18.691086+00 |
| updated_at | 2024-02-17 21:27:56.113138+00 |
| description | A small path trait extension with some convenience methods. |
| homepage | https://github.com/jtk18/pathext |
| repository | https://github.com/jtk18/pathext |
| max_upload_size | |
| id | 507342 |
| size | 11,156 |
A small collection of utilities on Path and PathBuf, technically AsRef<Path> which includes &str.
use pathext::PathExt;
use std::ops::Not;
use std::path::Path;
// Because of this expectation breaking difference:
assert!("archive.tar.gz").ends_with(".tar.gz"));
assert!(Path::new("archive.tar.gz").ends_with(".tar.gz").not());
// Instead use:
assert!("archive.tar.gz").ends_with_extentions(".tar.gz"));
assert!(Path::new()"archive.tar.gz")).ends_with_extentions(".tar.gz"));
// Plus some more utility
assert!("/some/path".has_component("path"));
assert!("multiple-extensions.tar.gz".strip_extensions(), Some("multiple-extensions"));