2 releases

0.0.1 Apr 22, 2020
0.0.0 Apr 22, 2020
Download history 710/week @ 2021-09-26 686/week @ 2021-10-03 614/week @ 2021-10-10 634/week @ 2021-10-17 642/week @ 2021-10-24 586/week @ 2021-10-31 372/week @ 2021-11-07 609/week @ 2021-11-14 497/week @ 2021-11-21 604/week @ 2021-11-28 516/week @ 2021-12-05 463/week @ 2021-12-12 510/week @ 2021-12-19 444/week @ 2021-12-26 422/week @ 2022-01-02 330/week @ 2022-01-09

1,744 downloads per month
Used in 6 crates (5 directly)

CC0 license

6KB
60 lines

lexiclean

Lexically clean rust paths.

See the docs for more information.


lib.rs:

This crate exports a single trait, Lexiclean, with a single method, lexiclean, implemented on &Path, that performs lexical path cleaning.

Lexical path cleaning simplifies paths without looking at the underlying filesystem. This means:

  • Normally, if file is a file and not a directory, the path file/.. will fail to resolve to. Lexiclean resolves this to .

  • Path::canonicalize returns io::Result<PathBuf>, because it must make system calls, that might fail. Lexiclean does not make system calls, and thus cannot fail.

  • The path returned by lexiclean will only contain components present in the input path. This can make the resultant paths more legible for users, since foo/.. will resolve to ., and not /Some/absolute/directory.

  • Lexiclean does not respect symlinks.

  • Lexiclean has only been lightly tested. In particular, it has not been tested with windows paths, which are very complicated, and can contain many types of components that the author of this crate never contemplated.

    Additional test cases and bug fixes are most welcome!

No runtime deps

"ߟ^