UTF-8 encoded path types for Rust, providing guaranteed UTF-8 strings for file system operations.
Camino is a Rust library that extends the standard library's `std::path` module with UTF-8 guaranteed path types. It provides `Utf8Path` and `Utf8PathBuf` types that eliminate repetitive and error-prone conversions by encoding the UTF-8 invariant directly into the type system, addressing the common assumption that file paths are valid UTF-8.
Rust developers building portable, cross-platform software that interacts with file systems, especially those working with systems that already assume UTF-8 paths (like Cargo) or where files contain names of other files (avoiding the 'makefile problem').
Developers choose Camino because it provides a drop-in replacement for `Path` and `PathBuf` with guaranteed UTF-8 encoding, removing the need for repeated `to_str().unwrap()` calls and exposing path contents directly as strings. Its simplicity and safety through type system invariants reduce boilerplate and potential errors for the vast majority of use cases where non-Unicode paths are unnecessary.
Like Rust's std::path::Path, but UTF-8.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Guarantees paths are valid UTF-8, allowing direct string manipulation and eliminating the need for repetitive and error-prone `to_str().unwrap()` calls, as highlighted in the README's examples.
Designed as direct replacements for `Path` and `PathBuf` with minimal API differences, making integration straightforward and maintaining compatibility with existing code that uses `AsRef<Path>`.
Unicode paths are the common subset supported across Windows and Unix platforms, making it ideal for portable software, as explained in the README's philosophy.
Exposes path contents as strings, implements `Display`, and iterates over components as `&str`, reducing boilerplate for common operations like formatting and iteration.
Supports dependencies like `serde1` for serialization and `proptest1` for testing only when enabled, keeping the core library lightweight without mandatory bloat.
Cannot handle paths that are not valid UTF-8, which the README explicitly admits makes it unsuitable for legacy systems, corrupt data, or tools requiring full path compatibility.
Does not support unstable Rust APIs, potentially restricting access to cutting-edge language features, as noted in the Rust version support section.
Requires paths to be validated as UTF-8 early; if validation fails, the library cannot be used, adding complexity to error handling in environments with mixed path encodings.