pathext

Crates.iopathext
lib.rspathext
version0.2.1
sourcesrc
created_at2022-01-03 21:27:18.691086
updated_at2024-02-17 21:27:56.113138
descriptionA small path trait extension with some convenience methods.
homepagehttps://github.com/jtk18/pathext
repositoryhttps://github.com/jtk18/pathext
max_upload_size
id507342
size11,156
Jason Kiniry (jtk18)

documentation

README

PathExt

A small collection of utilities on Path and PathBuf, technically AsRef<Path> which includes &str.

Simple usage

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"));
Commit count: 15

cargo fmt