path_abs: ergonomic paths and files in rust.
This library aims to provide ergonomic path and file operations to rust with reasonable performance.
The stdlib Path
, PathBuf
and File
objects have non-helpful error messages
(they don't mention the path where an error is from!) and don't tell you
anything about the type the path was or whether the path even exists. It is
also next to impossible to compare paths(does one have a symlink? What is the
current workind directory? Etc).
The path_abs crate aims to make working with paths and files ergonomic, so that you can (in general) be protected from errors by the types of your path/file.
From the type you can tell:
- The path you have existed (at least at one time).
- The path you have is a certain type (
PathFile
orPathDir
) - Any errors that happen when querying the filesystem will include information about the path.
- Methods related to your type are within easy reach. For example, you can
PathFile.append_str("something")
orPathDir.list()
. - Open files have types which only impelement traits/methods related to
their abilities.
FileRead
can only read,FileWrite
can only write andFileEdit
can do both. These types are guaranteed by their constructors to be able to accomplish their method and trait implemenations, and they give better errors too!
See the library docs for more information
LICENSE
The source code in this repository is Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.